Files
firefly-iii/app/Repositories/Currency/CurrencyRepositoryInterface.php

67 lines
2.2 KiB
PHP
Raw Normal View History

2015-04-05 20:47:19 +02:00
<?php
2022-12-29 19:42:26 +01:00
/**
* CurrencyRepositoryInterface.php
2020-02-16 14:00:57 +01:00
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2017-10-21 08:40:00 +02:00
*
* This program is distributed in the hope that it will be useful,
2017-10-21 08:40:00 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2017-10-21 08:40:00 +02:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
2015-04-05 20:47:19 +02:00
namespace FireflyIII\Repositories\Currency;
use Carbon\Carbon;
use FireflyIII\Models\CurrencyExchangeRate;
2015-04-05 20:47:19 +02:00
use FireflyIII\Models\TransactionCurrency;
use Illuminate\Support\Collection;
/**
2017-11-15 12:25:49 +01:00
* Interface CurrencyRepositoryInterface.
2015-04-05 20:47:19 +02:00
*/
interface CurrencyRepositoryInterface
{
2024-12-22 08:43:12 +01:00
public function find(int $currencyId): ?TransactionCurrency;
/**
* Find by currency code, return NULL if unfound.
*
2023-10-28 06:58:33 +02:00
* Used in the download exchange rates cron job. Does not require user object.
2018-02-16 15:19:19 +01:00
*/
2023-10-28 06:58:33 +02:00
public function findByCode(string $currencyCode): ?TransactionCurrency;
2019-03-08 05:47:51 +01:00
/**
2023-10-28 06:58:33 +02:00
* Returns the complete set of transactions but needs
* no user object.
*
2023-10-28 06:58:33 +02:00
* Used by the download exchange rate cron job.
2017-08-18 15:14:44 +02:00
*/
2023-10-28 06:58:33 +02:00
public function getCompleteSet(): Collection;
2015-04-05 20:47:19 +02:00
/**
2018-06-28 07:32:58 +02:00
* Get currency exchange rate.
*
2023-10-28 06:58:33 +02:00
* Used in the download exchange rate cron job. Needs the user object!
*/
2018-06-28 07:32:58 +02:00
public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate;
/**
2023-10-28 06:58:33 +02:00
* Set currency exchange rate.
*
2023-10-28 06:58:33 +02:00
* Used in download exchange rate cron job. Needs the user object!
2022-12-29 19:42:26 +01:00
*/
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate;
2015-04-07 18:25:21 +02:00
}