mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Various code cleanup.
This commit is contained in:
@@ -114,14 +114,11 @@ class AmountFormat extends Twig_Extension
|
||||
*
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
protected function formatAmountBySymbol(): Twig_SimpleFunction
|
||||
protected function formatAmountByCurrency(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
|
||||
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
|
||||
|
||||
$currency = new TransactionCurrency;
|
||||
$currency->symbol = $symbol;
|
||||
$currency->decimal_places = $decimalPlaces;
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
|
||||
|
||||
@@ -134,10 +131,14 @@ class AmountFormat extends Twig_Extension
|
||||
*
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
protected function formatAmountByCurrency(): Twig_SimpleFunction
|
||||
protected function formatAmountBySymbol(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
|
||||
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
|
||||
|
||||
$currency = new TransactionCurrency;
|
||||
$currency->symbol = $symbol;
|
||||
$currency->decimal_places = $decimalPlaces;
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
|
||||
|
||||
@@ -57,6 +57,14 @@ class Translation extends Twig_Extension
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Translation';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
@@ -64,9 +72,9 @@ class Translation extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'journalLinkTranslation', function (int $linkTypeId, string $direction, string $original) {
|
||||
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
|
||||
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
|
||||
$translation = trans($key);
|
||||
if($key === $translation) {
|
||||
if ($key === $translation) {
|
||||
return $original;
|
||||
}
|
||||
|
||||
@@ -76,12 +84,4 @@ class Translation extends Twig_Extension
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Translation';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user