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

154 lines
3.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.
*/
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\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
/**
* 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;
2016-10-10 07:12:39 +02:00
/**
* @param int $accountId
*
* @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
*
* @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 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;
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;
2015-03-29 08:14:32 +02:00
}