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

90 lines
2.2 KiB
PHP
Raw Normal View History

2015-02-09 07:23:39 +01: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.
*/
2016-02-05 12:08:25 +01:00
declare(strict_types = 1);
2015-02-09 07:23:39 +01:00
namespace FireflyIII\Repositories\Account;
2015-03-29 21:27:51 +02:00
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
2015-03-29 21:27:51 +02:00
use FireflyIII\Models\TransactionJournal;
2015-03-13 08:44:07 +01:00
use Illuminate\Support\Collection;
2015-03-29 21:27:51 +02:00
2015-02-11 07:35:10 +01:00
/**
* Interface AccountRepositoryInterface
*
* @package FireflyIII\Repositories\Account
*/
2015-02-09 07:23:39 +01: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;
/**
* Returns the transaction from a journal that is related to a given account. Since a journal generally only contains
* two transactions, this will return one of the two. This method fails horribly when the journal has more than two transactions,
* but luckily it isn't used for such folly.
*
2016-01-19 13:59:54 +01:00
* @param TransactionJournal $journal
* @param Account $account
*
2016-01-19 13:59:54 +01:00
* @return Transaction
* @throws FireflyException
*/
2016-02-06 16:22:12 +01:00
public function getFirstTransaction(TransactionJournal $journal, Account $account): Transaction;
/**
* 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;
2015-02-24 21:10:25 +01:00
/**
2016-05-13 15:53:39 +02:00
*
2015-02-24 21:10:25 +01:00
* @param Account $account
*
2016-02-06 16:22:12 +01:00
* @return TransactionJournal
2015-02-24 21:10:25 +01:00
*/
2016-02-06 16:22:12 +01:00
public function openingBalanceTransaction(Account $account) : TransactionJournal;
2015-03-21 08:51:34 +01:00
2015-03-29 08:14:32 +02:00
}