mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AmountFormat.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* General.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -85,15 +86,15 @@ class General extends AbstractExtension
|
||||
static function (int $size): string {
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
return round($size / (1024 * 1024), 2) . ' MB';
|
||||
return round($size / (1024 * 1024), 2).' MB';
|
||||
}
|
||||
|
||||
// less than one MB
|
||||
if ($size < (1024 * 1024)) {
|
||||
return round($size / 1024, 2) . ' KB';
|
||||
return round($size / 1024, 2).' KB';
|
||||
}
|
||||
|
||||
return $size . ' bytes';
|
||||
return $size.' bytes';
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -192,7 +193,7 @@ class General extends AbstractExtension
|
||||
]
|
||||
);
|
||||
|
||||
return (string) $converter->convert($text);
|
||||
return (string)$converter->convert($text);
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
);
|
||||
@@ -208,8 +209,8 @@ class General extends AbstractExtension
|
||||
return new TwigFilter(
|
||||
'phphost',
|
||||
static function (string $string): string {
|
||||
$proto = (string) parse_url($string, PHP_URL_SCHEME);
|
||||
$host = (string) parse_url($string, PHP_URL_HOST);
|
||||
$proto = (string)parse_url($string, PHP_URL_SCHEME);
|
||||
$host = (string)parse_url($string, PHP_URL_HOST);
|
||||
|
||||
return e(sprintf('%s://%s', $proto, $host));
|
||||
}
|
||||
@@ -406,7 +407,7 @@ class General extends AbstractExtension
|
||||
return new TwigFunction(
|
||||
'getRootSearchOperator',
|
||||
static function (string $operator): string {
|
||||
$result = OperatorQuerySearch::getRootOperator($operator);
|
||||
$result = OperatorQuerySearch::getRootOperator($operator);
|
||||
return str_replace('-', 'not_', $result);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Rule.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -52,8 +53,8 @@ class Rule extends AbstractExtension
|
||||
'allJournalTriggers',
|
||||
static function () {
|
||||
return [
|
||||
'store-journal' => (string) trans('firefly.rule_trigger_store_journal'),
|
||||
'update-journal' => (string) trans('firefly.rule_trigger_update_journal'),
|
||||
'store-journal' => (string)trans('firefly.rule_trigger_store_journal'),
|
||||
'update-journal' => (string)trans('firefly.rule_trigger_update_journal'),
|
||||
];
|
||||
}
|
||||
);
|
||||
@@ -71,7 +72,7 @@ class Rule extends AbstractExtension
|
||||
$possibleTriggers = [];
|
||||
foreach ($ruleTriggers as $key) {
|
||||
if ('user_action' !== $key) {
|
||||
$possibleTriggers[$key] = (string) trans('firefly.rule_trigger_' . $key . '_choice');
|
||||
$possibleTriggers[$key] = (string)trans('firefly.rule_trigger_'.$key.'_choice');
|
||||
}
|
||||
}
|
||||
unset($ruleTriggers);
|
||||
@@ -94,7 +95,7 @@ class Rule extends AbstractExtension
|
||||
$ruleActions = array_keys(Config::get('firefly.rule-actions'));
|
||||
$possibleActions = [];
|
||||
foreach ($ruleActions as $key) {
|
||||
$possibleActions[$key] = (string) trans('firefly.rule_action_' . $key . '_choice');
|
||||
$possibleActions[$key] = (string)trans('firefly.rule_action_'.$key.'_choice');
|
||||
}
|
||||
unset($ruleActions);
|
||||
asort($possibleActions);
|
||||
|
||||
@@ -79,7 +79,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
/**
|
||||
* Generate normal amount for transaction from a transaction group.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
$colored = false;
|
||||
}
|
||||
|
||||
$result = app('amount')->formatFlat($array['currency_symbol'], (int) $array['currency_decimal_places'], $amount, $colored);
|
||||
$result = app('amount')->formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored);
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$result = sprintf('<span class="text-info">%s</span>', $result);
|
||||
}
|
||||
@@ -104,9 +104,9 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
* @param string $transactionType
|
||||
* @param string $sourceType
|
||||
* @param string $amount
|
||||
* @param string $transactionType
|
||||
* @param string $sourceType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -133,7 +133,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
/**
|
||||
* Generate foreign amount for transaction from a transaction group.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -149,7 +149,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$colored = false;
|
||||
}
|
||||
$result = app('amount')->formatFlat($array['foreign_currency_symbol'], (int) $array['foreign_currency_decimal_places'], $amount, $colored);
|
||||
$result = app('amount')->formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored);
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$result = sprintf('<span class="text-info">%s</span>', $result);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
/**
|
||||
* Generate normal amount for transaction from a transaction group.
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -201,7 +201,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$colored = false;
|
||||
}
|
||||
$result = app('amount')->formatFlat($currency->symbol, (int) $currency->decimal_places, $amount, $colored);
|
||||
$result = app('amount')->formatFlat($currency->symbol, (int)$currency->decimal_places, $amount, $colored);
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$result = sprintf('<span class="text-info">%s</span>', $result);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -225,7 +225,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
/**
|
||||
* Generate foreign amount for journal from a transaction group.
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -244,7 +244,7 @@ class TransactionGroupTwig extends AbstractExtension
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$colored = false;
|
||||
}
|
||||
$result = app('amount')->formatFlat($currency->symbol, (int) $currency->decimal_places, $amount, $colored);
|
||||
$result = app('amount')->formatFlat($currency->symbol, (int)$currency->decimal_places, $amount, $colored);
|
||||
if ($type === TransactionType::TRANSFER) {
|
||||
$result = sprintf('<span class="text-info">%s</span>', $result);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Translation.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -40,7 +41,7 @@ class Translation extends AbstractExtension
|
||||
new TwigFilter(
|
||||
'_',
|
||||
static function ($name) {
|
||||
return (string) trans(sprintf('firefly.%s', $name));
|
||||
return (string)trans(sprintf('firefly.%s', $name));
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user