Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -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
{