Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:42:26 +01:00
parent dbf3e76ecc
commit 6cfdc58cb1
415 changed files with 7462 additions and 6874 deletions

View File

@@ -52,7 +52,7 @@ class AccountTransformer extends AbstractTransformer
/**
* Transform the account.
*
* @param Account $account
* @param Account $account
*
* @return array
* @throws JsonException
@@ -63,8 +63,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');
@@ -87,17 +87,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'], true)) {
$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,
@@ -132,23 +132,23 @@ class AccountTransformer extends AbstractTransformer
'links' => [
[
'rel' => 'self',
'uri' => '/accounts/' . $account->id,
'uri' => '/accounts/'.$account->id,
],
],
];
}
/**
* @param Account $account
* @param Account $account
*
* @param string $accountType
* @param string $accountType
*
* @return string|null
*/
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;
}
@@ -170,7 +170,7 @@ class AccountTransformer extends AbstractTransformer
}
/**
* @param Account $account
* @param Account $account
*
* @return array
* @throws FireflyException
@@ -184,7 +184,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;
@@ -193,9 +193,9 @@ class AccountTransformer extends AbstractTransformer
}
/**
* @param Account $account
* @param string|null $accountRole
* @param string $accountType
* @param Account $account
* @param string|null $accountRole
* @param string $accountType
*
* @return array
*/
@@ -215,8 +215,8 @@ class AccountTransformer extends AbstractTransformer
}
/**
* @param Account $account
* @param string $accountType
* @param Account $account
* @param string $accountType
*
* @return array
*
@@ -239,8 +239,8 @@ class AccountTransformer extends AbstractTransformer
}
/**
* @param Account $account
* @param string $accountType
* @param Account $account
* @param string $accountType
*
* @return array
*/