mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Rearrange code [skip ci]
This commit is contained in:
@@ -84,7 +84,7 @@ class General extends Twig_Extension
|
||||
protected function activeRoutePartial(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartial', function () : string {
|
||||
'activeRoutePartial', function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
@@ -106,7 +106,7 @@ class General extends Twig_Extension
|
||||
protected function activeRoutePartialWhat(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartialWhat', function ($context) : string {
|
||||
'activeRoutePartialWhat', function ($context): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
@@ -130,7 +130,7 @@ class General extends Twig_Extension
|
||||
protected function activeRouteStrict(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRouteStrict', function () : string {
|
||||
'activeRouteStrict', function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
|
||||
@@ -149,7 +149,7 @@ class General extends Twig_Extension
|
||||
protected function balance(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'balance', function (Account $account = null) : string {
|
||||
'balance', function (Account $account = null): string {
|
||||
if (is_null($account)) {
|
||||
return 'NULL';
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class General extends Twig_Extension
|
||||
protected function env(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'env', function (string $name, string $default) : string {
|
||||
'env', function (string $name, string $default): string {
|
||||
return env($name, $default);
|
||||
}
|
||||
);
|
||||
@@ -179,7 +179,7 @@ class General extends Twig_Extension
|
||||
protected function formatAmount(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmount', function (string $string) : string {
|
||||
'formatAmount', function (string $string): string {
|
||||
|
||||
return app('amount')->format($string);
|
||||
}, ['is_safe' => ['html']]
|
||||
@@ -192,7 +192,7 @@ class General extends Twig_Extension
|
||||
protected function formatAmountPlain(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmountPlain', function (string $string) : string {
|
||||
'formatAmountPlain', function (string $string): string {
|
||||
|
||||
return app('amount')->format($string, false);
|
||||
}, ['is_safe' => ['html']]
|
||||
@@ -205,7 +205,7 @@ class General extends Twig_Extension
|
||||
protected function formatFilesize(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'filesize', function (int $size) : string {
|
||||
'filesize', function (int $size): string {
|
||||
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
@@ -228,7 +228,7 @@ class General extends Twig_Extension
|
||||
protected function formatJournal(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatJournal', function (TransactionJournal $journal) : string {
|
||||
'formatJournal', function (TransactionJournal $journal): string {
|
||||
return app('amount')->formatJournal($journal);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
@@ -240,7 +240,7 @@ class General extends Twig_Extension
|
||||
protected function getAccountRole(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'getAccountRole', function (string $name) : string {
|
||||
'getAccountRole', function (string $name): string {
|
||||
return Config::get('firefly.accountRoles.' . $name);
|
||||
}
|
||||
);
|
||||
@@ -252,7 +252,7 @@ class General extends Twig_Extension
|
||||
protected function getCurrencyCode(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getCurrencyCode', function () : string {
|
||||
'getCurrencyCode', function (): string {
|
||||
return app('amount')->getCurrencyCode();
|
||||
}
|
||||
);
|
||||
@@ -264,7 +264,7 @@ class General extends Twig_Extension
|
||||
protected function getCurrencySymbol(): Twig_SimpleFunction
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getCurrencySymbol', function () : string {
|
||||
'getCurrencySymbol', function (): string {
|
||||
return app('amount')->getCurrencySymbol();
|
||||
}
|
||||
);
|
||||
@@ -276,7 +276,7 @@ class General extends Twig_Extension
|
||||
protected function mimeIcon(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'mimeIcon', function (string $string) : string {
|
||||
'mimeIcon', function (string $string): string {
|
||||
switch ($string) {
|
||||
default:
|
||||
return 'fa-file-o';
|
||||
@@ -296,7 +296,7 @@ class General extends Twig_Extension
|
||||
protected function phpdate()
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'phpdate', function (string $str) : string {
|
||||
'phpdate', function (string $str): string {
|
||||
return date($str);
|
||||
}
|
||||
);
|
||||
@@ -308,7 +308,7 @@ class General extends Twig_Extension
|
||||
private function getAmountFromJournal()
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'getAmount', function (TransactionJournal $journal) : string {
|
||||
'getAmount', function (TransactionJournal $journal): string {
|
||||
return TransactionJournal::amount($journal);
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user