firefly-iii/app/Repositories/Account/AccountRepositoryInterface.php
2016-05-13 17:22:24 +02:00

189 lines
4.2 KiB
PHP

<?php
declare(strict_types = 1);
namespace FireflyIII\Repositories\Account;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
* Interface AccountRepositoryInterface
*
* @package FireflyIII\Repositories\Account
*/
interface AccountRepositoryInterface
{
/**
* @param array $types
*
* @return int
*/
public function countAccounts(array $types): int;
/**
* @param Account $account
* @param Account $moveTo
*
* @return bool
*/
public function destroy(Account $account, Account $moveTo): bool;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function earnedInPeriod(Collection $accounts, Carbon $start, Carbon $end): string;
/**
* @param int $accountId
*
* @return Account
*/
public function find(int $accountId): Account;
/**
* @param Account $account
*
* @return Carbon
*/
public function firstUseDate(Account $account): Carbon;
/**
* Gets all the accounts by ID, for a given set.
*
* @param array $ids
*
* @return \Illuminate\Support\Collection
*/
public function get(array $ids): Collection;
/**
* @param array $accountIds
*
* @return Collection
*/
public function getAccountsById(array $accountIds): Collection;
/**
* @param array $types
*
* @return Collection
*/
public function getAccountsByType(array $types): Collection;
/**
* @param TransactionJournal $journal
* @param Account $account
*
* @return Transaction
*/
public function getFirstTransaction(TransactionJournal $journal, Account $account): Transaction;
/**
* Get the accounts of a user that have piggy banks connected to them.
*
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getPiggyBankAccounts(Carbon $start, Carbon $end): Collection;
/**
* Get savings accounts.
*
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getSavingsAccounts(Carbon $start, Carbon $end): Collection;
/**
* @param Collection $accounts
* @param array $types
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function journalsInPeriod(Collection $accounts, array $types, Carbon $start, Carbon $end): Collection;
/**
*
* @param Account $account
* @param Carbon $date
*
* @return string
*/
public function leftOnAccount(Account $account, Carbon $date): string;
/**
* 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 Carbon
*/
public function oldestJournalDate(Account $account): Carbon;
/**
*
* @param Account $account
*
* @return TransactionJournal
*/
public function openingBalanceTransaction(Account $account) : TransactionJournal;
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function spentInPeriod(Collection $accounts, Carbon $start, Carbon $end): string;
/**
* @param array $data
*
* @return Account
*/
public function store(array $data) : Account;
/**
* @param $account
* @param $name
* @param $value
*
* @return AccountMeta
*/
public function storeMeta(Account $account, string $name, $value): AccountMeta;
/**
* @param Account $account
* @param array $data
*
* @return Account
*/
public function update(Account $account, array $data): Account;
}