2015-04-05 13:47:19 -05:00
|
|
|
<?php
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* CurrencyRepositoryInterface.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* 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-05-20 05:41:23 -05:00
|
|
|
*/
|
|
|
|
|
2016-02-05 05:08:25 -06:00
|
|
|
declare(strict_types = 1);
|
2015-04-05 13:47:19 -05:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Currency;
|
|
|
|
|
|
|
|
|
|
|
|
use FireflyIII\Models\Preference;
|
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface CurrencyRepositoryInterface
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Repositories\Currency
|
|
|
|
*/
|
|
|
|
interface CurrencyRepositoryInterface
|
|
|
|
{
|
2016-12-11 09:25:46 -06:00
|
|
|
/**
|
|
|
|
* @param TransactionCurrency $currency
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function canDeleteCurrency(TransactionCurrency $currency): bool;
|
|
|
|
|
2015-04-05 13:47:19 -05:00
|
|
|
/**
|
|
|
|
* @param TransactionCurrency $currency
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function countJournals(TransactionCurrency $currency): int;
|
2015-04-05 13:47:19 -05:00
|
|
|
|
2016-12-11 09:25:46 -06:00
|
|
|
/**
|
|
|
|
* @param TransactionCurrency $currency
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function destroy(TransactionCurrency $currency): bool;
|
|
|
|
|
2016-04-01 07:10:08 -05:00
|
|
|
/**
|
|
|
|
* Find by ID
|
|
|
|
*
|
|
|
|
* @param int $currencyId
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-12-04 11:02:19 -06:00
|
|
|
public function find(int $currencyId): TransactionCurrency;
|
2016-04-01 07:10:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find by currency code
|
|
|
|
*
|
|
|
|
* @param string $currencyCode
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-12-04 11:02:19 -06:00
|
|
|
public function findByCode(string $currencyCode): TransactionCurrency;
|
2016-04-01 07:10:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find by currency name
|
|
|
|
*
|
|
|
|
* @param string $currencyName
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-12-04 11:02:19 -06:00
|
|
|
public function findByName(string $currencyName): TransactionCurrency;
|
2016-04-01 07:10:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Find by currency symbol
|
|
|
|
*
|
|
|
|
* @param string $currencySymbol
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-12-04 11:02:19 -06:00
|
|
|
public function findBySymbol(string $currencySymbol): TransactionCurrency;
|
2016-04-01 07:10:08 -05:00
|
|
|
|
2015-04-05 13:47:19 -05:00
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function get(): Collection;
|
2015-04-05 13:47:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Preference $preference
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function getCurrencyByPreference(Preference $preference): TransactionCurrency;
|
2015-04-05 13:47:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function store(array $data): TransactionCurrency;
|
2015-04-05 13:47:19 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param TransactionCurrency $currency
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return TransactionCurrency
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function update(TransactionCurrency $currency, array $data): TransactionCurrency;
|
2015-04-05 13:47:19 -05:00
|
|
|
|
2015-04-07 11:25:21 -05:00
|
|
|
}
|