mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup.
This commit is contained in:
@@ -35,9 +35,6 @@ use Twig\TwigFunction;
|
||||
*/
|
||||
class AmountFormat extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
@@ -46,9 +43,15 @@ class AmountFormat extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TwigFilter
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
$this->formatAmountByAccount(),
|
||||
$this->formatAmountBySymbol(),
|
||||
$this->formatAmountByCurrency(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function formatAmount(): TwigFilter
|
||||
{
|
||||
return new TwigFilter(
|
||||
@@ -62,9 +65,6 @@ class AmountFormat extends AbstractExtension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TwigFilter
|
||||
*/
|
||||
protected function formatAmountPlain(): TwigFilter
|
||||
{
|
||||
return new TwigFilter(
|
||||
@@ -78,23 +78,11 @@ class AmountFormat extends AbstractExtension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
$this->formatAmountByAccount(),
|
||||
$this->formatAmountBySymbol(),
|
||||
$this->formatAmountByCurrency(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Will format the amount by the currency related to the given account.
|
||||
*
|
||||
* @return TwigFunction
|
||||
* TODO remove me when layout v1 is deprecated.
|
||||
* @return twigFunction
|
||||
* TODO remove me when layout v1 is deprecated
|
||||
*/
|
||||
protected function formatAmountByAccount(): TwigFunction
|
||||
{
|
||||
@@ -102,6 +90,7 @@ class AmountFormat extends AbstractExtension
|
||||
'formatAmountByAccount',
|
||||
static function (AccountModel $account, string $amount, bool $coloured = null): string {
|
||||
$coloured ??= true;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepos */
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$currency = $accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
@@ -114,8 +103,6 @@ class AmountFormat extends AbstractExtension
|
||||
|
||||
/**
|
||||
* Will format the amount by the currency related to the given account.
|
||||
*
|
||||
* @return TwigFunction
|
||||
*/
|
||||
protected function formatAmountBySymbol(): TwigFunction
|
||||
{
|
||||
@@ -136,8 +123,6 @@ class AmountFormat extends AbstractExtension
|
||||
|
||||
/**
|
||||
* Will format the amount by the currency related to the given account.
|
||||
*
|
||||
* @return TwigFunction
|
||||
*/
|
||||
protected function formatAmountByCurrency(): TwigFunction
|
||||
{
|
||||
|
Reference in New Issue
Block a user