Reformat various code.

This commit is contained in:
James Cole
2022-03-29 15:00:29 +02:00
parent d1a09ff33b
commit d04efb8325
81 changed files with 662 additions and 662 deletions

View File

@@ -62,8 +62,8 @@ class AccountTransformer extends AbstractTransformer
// get account type:
$fullType = $account->accountType->type;
$accountType = (string)config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
$liabilityType = (string)config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
$accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
$liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
$liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
$liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');
@@ -77,7 +77,7 @@ class AccountTransformer extends AbstractTransformer
[$openingBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType);
[$interest, $interestPeriod] = $this->getInterest($account, $accountType);
$openingBalance = number_format((float)$openingBalance, $decimalPlaces, '.', '');
$openingBalance = number_format((float) $openingBalance, $decimalPlaces, '.', '');
$includeNetWorth = '0' !== $this->repository->getMetaValue($account, 'include_net_worth');
$longitude = null;
$latitude = null;
@@ -86,17 +86,17 @@ class AccountTransformer extends AbstractTransformer
if (null !== $location) {
$longitude = $location->longitude;
$latitude = $location->latitude;
$zoomLevel = (int)$location->zoom_level;
$zoomLevel = (int) $location->zoom_level;
}
// no order for some accounts:
$order = (int)$account->order;
$order = (int) $account->order;
if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'])) {
$order = null;
}
return [
'id' => (string)$account->id,
'id' => (string) $account->id,
'created_at' => $account->created_at->toAtomString(),
'updated_at' => $account->updated_at->toAtomString(),
'active' => $account->active,
@@ -108,7 +108,7 @@ class AccountTransformer extends AbstractTransformer
'currency_code' => $currencyCode,
'currency_symbol' => $currencySymbol,
'currency_decimal_places' => $decimalPlaces,
'current_balance' => number_format((float)app('steam')->balance($account, $date), $decimalPlaces, '.', ''),
'current_balance' => number_format((float) app('steam')->balance($account, $date), $decimalPlaces, '.', ''),
'current_balance_date' => $date->toAtomString(),
'notes' => $this->repository->getNoteText($account),
'monthly_payment_date' => $monthlyPaymentDate,
@@ -116,7 +116,7 @@ class AccountTransformer extends AbstractTransformer
'account_number' => $this->repository->getMetaValue($account, 'account_number'),
'iban' => '' === $account->iban ? null : $account->iban,
'bic' => $this->repository->getMetaValue($account, 'BIC'),
'virtual_balance' => number_format((float)$account->virtual_balance, $decimalPlaces, '.', ''),
'virtual_balance' => number_format((float) $account->virtual_balance, $decimalPlaces, '.', ''),
'opening_balance' => $openingBalance,
'opening_balance_date' => $openingBalanceDate,
'liability_type' => $liabilityType,
@@ -147,7 +147,7 @@ class AccountTransformer extends AbstractTransformer
private function getAccountRole(Account $account, string $accountType): ?string
{
$accountRole = $this->repository->getMetaValue($account, 'account_role');
if ('asset' !== $accountType || '' === (string)$accountRole) {
if ('asset' !== $accountType || '' === (string) $accountRole) {
$accountRole = null;
}
@@ -180,7 +180,7 @@ class AccountTransformer extends AbstractTransformer
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUser($account->user);
}
$currencyId = (string)$currency->id;
$currencyId = (string) $currency->id;
$currencyCode = $currency->code;
$decimalPlaces = $currency->decimal_places;
$currencySymbol = $currency->symbol;