firefly-iii/app/Repositories/Account/AccountRepositoryInterface.php

149 lines
3.1 KiB
PHP
Raw Normal View History

2015-02-09 00:23:39 -06:00
<?php
/**
* AccountRepositoryInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
2015-02-09 00:23:39 -06:00
namespace FireflyIII\Repositories\Account;
2015-03-29 14:27:51 -05:00
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\User;
2016-10-10 00:25:27 -05:00
use Illuminate\Support\Collection;
2015-03-29 14:27:51 -05:00
2015-02-11 00:35:10 -06:00
/**
* Interface AccountRepositoryInterface
*
* @package FireflyIII\Repositories\Account
*/
2015-02-09 00:23:39 -06:00
interface AccountRepositoryInterface
{
/**
* Moved here from account CRUD.
*
* @param array $types
*
* @return int
*/
public function count(array $types): int;
/**
* Moved here from account CRUD.
*
* @param Account $account
* @param Account $moveTo
*
* @return bool
*/
public function destroy(Account $account, Account $moveTo): bool;
2016-10-10 00:12:39 -05:00
/**
* @param int $accountId
*
* @return Account
*/
public function find(int $accountId): Account;
2016-10-10 00:14:01 -05:00
/**
* @param string $number
* @param array $types
*
* @return Account
*/
public function findByAccountNumber(string $number, array $types): Account;
2016-10-10 00:16:05 -05:00
/**
* @param string $iban
* @param array $types
*
* @return Account
*/
public function findByIban(string $iban, array $types): Account;
2016-10-10 00:49:39 -05:00
/**
* @param string $name
* @param array $types
*
* @return Account
*/
public function findByName(string $name, array $types): Account;
/**
* @param array $accountIds
*
* @return Collection
*/
public function getAccountsById(array $accountIds): Collection;
/**
* @param array $types
*
* @return Collection
*/
public function getAccountsByType(array $types): Collection;
2016-10-10 00:53:12 -05:00
/**
* @param array $types
*
* @return Collection
*/
public function getActiveAccountsByType(array $types): Collection;
2016-11-21 13:23:25 -06:00
/**
* Returns the date of the very last transaction in this account.
*
* @param Account $account
*
* @return Carbon
*/
public function newestJournalDate(Account $account): Carbon;
/**
* Returns the date of the very first transaction in this account.
*
* @param Account $account
*
* @return TransactionJournal
*/
public function oldestJournal(Account $account): TransactionJournal;
/**
* Returns the date of the very first transaction in this account.
*
* @param Account $account
*
* @return Carbon
*/
public function oldestJournalDate(Account $account): Carbon;
2017-01-30 09:42:58 -06:00
/**
* @param User $user
*/
public function setUser(User $user);
2016-10-10 01:03:03 -05:00
/**
* @param array $data
*
* @return Account
*/
2016-11-28 11:55:56 -06:00
public function store(array $data): Account;
2016-10-10 01:03:03 -05:00
/**
* @param Account $account
* @param array $data
*
* @return Account
*/
public function update(Account $account, array $data): Account;
2015-03-29 01:14:32 -05:00
}