mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 06:01:21 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -45,9 +45,9 @@ class AccountForm
|
||||
/**
|
||||
* Grouped dropdown list of all accounts that are valid as the destination of a withdrawal.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -57,8 +57,8 @@ class AccountForm
|
||||
$repository = $this->getAccountRepository();
|
||||
$grouped = $this->getAccountsGrouped($types, $repository);
|
||||
$cash = $repository->getCashAccount();
|
||||
$key = (string) trans('firefly.cash_account_type');
|
||||
$grouped[$key][$cash->id] = sprintf('(%s)', (string) trans('firefly.cash'));
|
||||
$key = (string)trans('firefly.cash_account_type');
|
||||
$grouped[$key][$cash->id] = sprintf('(%s)', (string)trans('firefly.cash'));
|
||||
|
||||
return $this->select($name, $grouped, $value, $options);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class AccountForm
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accountList as $account) {
|
||||
$role = (string) $repository->getMetaValue($account, 'account_role');
|
||||
$role = (string)$repository->getMetaValue($account, 'account_role');
|
||||
if (in_array($account->accountType->type, $liabilityTypes, true)) {
|
||||
$role = sprintf('l_%s', $account->accountType->type);
|
||||
} elseif ('' === $role) {
|
||||
@@ -86,7 +86,7 @@ class AccountForm
|
||||
$role = 'no_account_type';
|
||||
}
|
||||
}
|
||||
$key = (string) trans(sprintf('firefly.opt_group_%s', $role));
|
||||
$key = (string)trans(sprintf('firefly.opt_group_%s', $role));
|
||||
$grouped[$key][$account->id] = $account->name;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ class AccountForm
|
||||
/**
|
||||
* Grouped dropdown list of all accounts that are valid as the destination of a withdrawal.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -109,8 +109,8 @@ class AccountForm
|
||||
$grouped = $this->getAccountsGrouped($types, $repository);
|
||||
|
||||
$cash = $repository->getCashAccount();
|
||||
$key = (string) trans('firefly.cash_account_type');
|
||||
$grouped[$key][$cash->id] = sprintf('(%s)', (string) trans('firefly.cash'));
|
||||
$key = (string)trans('firefly.cash_account_type');
|
||||
$grouped[$key][$cash->id] = sprintf('(%s)', (string)trans('firefly.cash'));
|
||||
|
||||
return $this->select($name, $grouped, $value, $options);
|
||||
}
|
||||
@@ -118,8 +118,8 @@ class AccountForm
|
||||
/**
|
||||
* Check list of asset accounts.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -150,9 +150,9 @@ class AccountForm
|
||||
/**
|
||||
* Basic list of asset accounts.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -167,9 +167,9 @@ class AccountForm
|
||||
/**
|
||||
* Same list but all liabilities as well.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -41,9 +41,9 @@ class CurrencyForm
|
||||
use FormSupport;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -53,10 +53,10 @@ class CurrencyForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -77,8 +77,8 @@ class CurrencyForm
|
||||
if (!is_array($preFilled)) {
|
||||
$preFilled = [];
|
||||
}
|
||||
$key = 'amount_currency_id_' . $name;
|
||||
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int) $preFilled[$key] : $defaultCurrency->id;
|
||||
$key = 'amount_currency_id_'.$name;
|
||||
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
|
||||
|
||||
Log::debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
|
||||
|
||||
@@ -96,7 +96,7 @@ class CurrencyForm
|
||||
$value = app('steam')->bcround($value, $defaultCurrency->decimal_places);
|
||||
}
|
||||
try {
|
||||
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
$html = view('form.'.$view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
|
||||
$html = 'Could not render currencyField.';
|
||||
@@ -109,9 +109,9 @@ class CurrencyForm
|
||||
/**
|
||||
* TODO describe and cleanup.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -123,10 +123,10 @@ class CurrencyForm
|
||||
/**
|
||||
* TODO describe and cleanup
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -147,8 +147,8 @@ class CurrencyForm
|
||||
if (!is_array($preFilled)) {
|
||||
$preFilled = [];
|
||||
}
|
||||
$key = 'amount_currency_id_' . $name;
|
||||
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int) $preFilled[$key] : $defaultCurrency->id;
|
||||
$key = 'amount_currency_id_'.$name;
|
||||
$sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
|
||||
|
||||
Log::debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
|
||||
|
||||
@@ -166,7 +166,7 @@ class CurrencyForm
|
||||
$value = app('steam')->bcround($value, $defaultCurrency->decimal_places);
|
||||
}
|
||||
try {
|
||||
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
$html = view('form.'.$view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
|
||||
$html = 'Could not render currencyField.';
|
||||
@@ -179,9 +179,9 @@ class CurrencyForm
|
||||
/**
|
||||
* TODO cleanup and describe
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -195,7 +195,7 @@ class CurrencyForm
|
||||
$array = [];
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($list as $currency) {
|
||||
$array[$currency->id] = $currency->name . ' (' . $currency->symbol . ')';
|
||||
$array[$currency->id] = $currency->name.' ('.$currency->symbol.')';
|
||||
}
|
||||
|
||||
return $this->select($name, $array, $value, $options);
|
||||
@@ -204,9 +204,9 @@ class CurrencyForm
|
||||
/**
|
||||
* TODO cleanup and describe
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -218,11 +218,11 @@ class CurrencyForm
|
||||
// get all currencies:
|
||||
$list = $currencyRepos->get();
|
||||
$array = [
|
||||
0 => (string) trans('firefly.no_currency'),
|
||||
0 => (string)trans('firefly.no_currency'),
|
||||
];
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($list as $currency) {
|
||||
$array[$currency->id] = $currency->name . ' (' . $currency->symbol . ')';
|
||||
$array[$currency->id] = $currency->name.' ('.$currency->symbol.')';
|
||||
}
|
||||
|
||||
return $this->select($name, $array, $value, $options);
|
||||
|
||||
@@ -37,10 +37,10 @@ use Throwable;
|
||||
trait FormSupport
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array|null $list
|
||||
* @param mixed $selected
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param array|null $list
|
||||
* @param mixed $selected
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -63,8 +63,8 @@ trait FormSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -76,13 +76,13 @@ trait FormSupport
|
||||
}
|
||||
$name = str_replace('[]', '', $name);
|
||||
|
||||
return (string) trans('form.' . $name);
|
||||
return (string)trans('form.'.$name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $label
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $label
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -91,7 +91,7 @@ trait FormSupport
|
||||
$options = $options ?? [];
|
||||
$name = str_replace('[]', '', $name);
|
||||
$options['class'] = 'form-control';
|
||||
$options['id'] = 'ffInput_' . $name;
|
||||
$options['id'] = 'ffInput_'.$name;
|
||||
$options['autocomplete'] = 'off';
|
||||
$options['placeholder'] = ucfirst($label);
|
||||
|
||||
@@ -99,7 +99,7 @@ trait FormSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -118,8 +118,8 @@ trait FormSupport
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed|null $value
|
||||
* @param string $name
|
||||
* @param mixed|null $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@@ -38,9 +38,9 @@ class PiggyBankForm
|
||||
/**
|
||||
* TODO cleanup and describe
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -50,7 +50,7 @@ class PiggyBankForm
|
||||
/** @var PiggyBankRepositoryInterface $repository */
|
||||
$repository = app(PiggyBankRepositoryInterface::class);
|
||||
$piggyBanks = $repository->getPiggyBanksWithAmount();
|
||||
$title = (string) trans('firefly.default_group_title_name');
|
||||
$title = (string)trans('firefly.default_group_title_name');
|
||||
$array = [];
|
||||
$subList = [
|
||||
0 => [
|
||||
@@ -58,7 +58,7 @@ class PiggyBankForm
|
||||
'title' => $title,
|
||||
],
|
||||
'piggies' => [
|
||||
(string) trans('firefly.none_in_select_list'),
|
||||
(string)trans('firefly.none_in_select_list'),
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -72,11 +72,11 @@ class PiggyBankForm
|
||||
$groupOrder = $group->order;
|
||||
}
|
||||
$subList[$groupOrder] = $subList[$groupOrder] ?? [
|
||||
'group' => [
|
||||
'title' => $groupTitle,
|
||||
],
|
||||
'piggies' => [],
|
||||
];
|
||||
'group' => [
|
||||
'title' => $groupTitle,
|
||||
],
|
||||
'piggies' => [],
|
||||
];
|
||||
$subList[$groupOrder]['piggies'][$piggy->id] = $piggy->name;
|
||||
}
|
||||
ksort($subList);
|
||||
|
||||
@@ -37,9 +37,9 @@ class RuleForm
|
||||
use FormSupport;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -60,9 +60,9 @@ class RuleForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array|null $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return HtmlString
|
||||
*/
|
||||
@@ -76,11 +76,11 @@ class RuleForm
|
||||
// get all currencies:
|
||||
$list = $groupRepos->get();
|
||||
$array = [
|
||||
0 => (string) trans('firefly.none_in_select_list'),
|
||||
0 => (string)trans('firefly.none_in_select_list'),
|
||||
];
|
||||
/** @var RuleGroup $group */
|
||||
foreach ($list as $group) {
|
||||
if (array_key_exists('hidden', $options) && (int) $options['hidden'] !== $group->id) {
|
||||
if (array_key_exists('hidden', $options) && (int)$options['hidden'] !== $group->id) {
|
||||
$array[$group->id] = $group->title;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user