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

221 lines
5.0 KiB
PHP
Raw Normal View History

2015-02-09 07:23:39 +01:00
<?php
/**
* AccountRepositoryInterface.php
2017-10-21 08:40:00 +02:00
* Copyright (c) 2017 thegrumpydictator@gmail.com
*
2017-10-21 08:40:00 +02:00
* This file is part of Firefly III.
*
2017-10-21 08:40:00 +02:00
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2017-12-17 14:44:05 +01:00
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
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\Models\Account;
use FireflyIII\Models\AccountType;
2017-12-31 10:40:27 +01:00
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\User;
2016-10-10 07:25:27 +02:00
use Illuminate\Support\Collection;
2015-03-29 21:27:51 +02:00
2015-02-11 07:35:10 +01:00
/**
2017-11-15 12:25:49 +01:00
* Interface AccountRepositoryInterface.
2015-02-11 07:35:10 +01:00
*/
2015-02-09 07:23:39 +01:00
interface AccountRepositoryInterface
{
2017-12-31 10:40:27 +01:00
/**
* Moved here from account CRUD.
*
* @param array $types
*
* @return int
*/
public function count(array $types): int;
/**
* Moved here from account CRUD.
*
2018-03-10 22:38:20 +01:00
* @param Account $account
2018-02-23 16:21:28 +01:00
* @param Account|null $moveTo
*
* @return bool
*/
2018-02-23 16:21:28 +01:00
public function destroy(Account $account, ?Account $moveTo): bool;
2016-10-10 07:12:39 +02:00
/**
* @param int $accountId
*
2018-02-16 15:19:19 +01:00
* @deprecated
2016-10-10 07:12:39 +02:00
* @return Account
*/
public function find(int $accountId): Account;
2016-10-10 07:14:01 +02:00
/**
* @param string $number
* @param array $types
*
* @return Account
*/
public function findByAccountNumber(string $number, array $types): Account;
2016-10-10 07:16:05 +02:00
/**
* @param string $iban
* @param array $types
*
* @return Account
*/
public function findByIban(string $iban, array $types): Account;
2016-10-10 07:49:39 +02:00
/**
* @param string $name
* @param array $types
*
2018-02-16 15:19:19 +01:00
* @return Account|null
2016-10-10 07:49:39 +02:00
*/
2018-02-16 15:19:19 +01:00
public function findByName(string $name, array $types): ?Account;
2016-10-10 07:49:39 +02:00
2018-02-16 22:14:53 +01:00
/**
* @param int $accountId
*
* @return Account|null
*/
public function findNull(int $accountId): ?Account;
/**
* Return account type by string.
*
* @param string $type
*
* @return AccountType|null
*/
public function getAccountType(string $type): ?AccountType;
2016-10-10 07:49:39 +02:00
/**
* @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 07:53:12 +02:00
/**
* @param array $types
*
* @return Collection
*/
public function getActiveAccountsByType(array $types): Collection;
2017-06-05 11:12:50 +02:00
/**
* @return Account
*/
public function getCashAccount(): Account;
/**
* @param Account $account
*
* @return Note|null
*/
public function getNote(Account $account): ?Note;
2018-02-16 22:14:53 +01:00
/**
* Returns the amount of the opening balance for this account.
*
* @param Account $account
*
* @return string
*/
public function getOpeningBalanceAmount(Account $account): ?string;
/**
* Return date of opening balance as string or null.
*
* @param Account $account
*
* @return null|string
*/
public function getOpeningBalanceDate(Account $account): ?string;
2017-11-22 17:49:06 +01:00
/**
* Find or create the opposing reconciliation account.
*
* @param Account $account
*
* @return Account|null
*/
public function getReconciliation(Account $account): ?Account;
2016-11-21 20:23:25 +01: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 16:42:58 +01:00
/**
* @param User $user
*/
public function setUser(User $user);
2016-10-10 08:03:03 +02:00
/**
* @param array $data
*
* @return Account
*/
2016-11-28 18:55:56 +01:00
public function store(array $data): Account;
2016-10-10 08:03:03 +02:00
/**
* @param Account $account
* @param array $data
*
* @return Account
*/
public function update(Account $account, array $data): Account;
/**
* @param TransactionJournal $journal
* @param array $data
*
* @return TransactionJournal
*/
public function updateReconciliation(TransactionJournal $journal, array $data): TransactionJournal;
2015-03-29 08:14:32 +02:00
}