Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:37 +01:00
parent f53923f16c
commit f52675068b
151 changed files with 251 additions and 403 deletions

View File

@@ -45,7 +45,7 @@ class AccountTransformer extends AbstractTransformer
*/
public function __construct()
{
$this->parameters = new ParameterBag;
$this->parameters = new ParameterBag();
$this->repository = app(AccountRepositoryInterface::class);
}
@@ -92,7 +92,7 @@ class AccountTransformer extends AbstractTransformer
// no order for some accounts:
$order = (int) $account->order;
if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'])) {
if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'], true)) {
$order = null;
}

View File

@@ -76,5 +76,4 @@ class AttachmentTransformer extends AbstractTransformer
],
];
}
}

View File

@@ -254,7 +254,7 @@ class BillTransformer extends AbstractTransformer
return [];
}
$set = new Collection;
$set = new Collection();
$currentStart = clone $this->parameters->get('start');
$loop = 0;
while ($currentStart <= $this->parameters->get('end')) {

View File

@@ -48,7 +48,7 @@ class BudgetLimitTransformer extends AbstractTransformer
*/
public function includeBudget(BudgetLimit $limit)
{
return $this->item($limit->budget, new BudgetTransformer, 'budgets');
return $this->item($limit->budget, new BudgetTransformer(), 'budgets');
}
/**
@@ -63,7 +63,11 @@ class BudgetLimitTransformer extends AbstractTransformer
$repository = app(OperationsRepository::class);
$repository->setUser($budgetLimit->budget->user);
$expenses = $repository->sumExpenses(
$budgetLimit->start_date, $budgetLimit->end_date, null, new Collection([$budgetLimit->budget]), $budgetLimit->transactionCurrency
$budgetLimit->start_date,
$budgetLimit->end_date,
null,
new Collection([$budgetLimit->budget]),
$budgetLimit->transactionCurrency
);
$currency = $budgetLimit->transactionCurrency;
$amount = $budgetLimit->amount;

View File

@@ -126,5 +126,4 @@ class BudgetTransformer extends AbstractTransformer
return $return;
}
}

View File

@@ -30,7 +30,6 @@ use FireflyIII\Models\TransactionCurrency;
*/
class CurrencyTransformer extends AbstractTransformer
{
/**
* Transform the currency.
*

View File

@@ -69,5 +69,4 @@ class ObjectGroupTransformer extends AbstractTransformer
],
];
}
}

View File

@@ -98,5 +98,4 @@ class PiggyBankEventTransformer extends AbstractTransformer
],
];
}
}

View File

@@ -46,7 +46,5 @@ class PreferenceTransformer extends AbstractTransformer
'name' => $preference->name,
'data' => $preference->data,
];
}
}

View File

@@ -60,7 +60,6 @@ class RecurrenceTransformer extends AbstractTransformer
$this->factory = app(CategoryFactory::class);
$this->budgetRepos = app(BudgetRepositoryInterface::class);
$this->billRepos = app(BillRepositoryInterface::class);
}
/**
@@ -138,7 +137,7 @@ class RecurrenceTransformer extends AbstractTransformer
];
// get the (future) occurrences for this specific type of repetition:
$occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon, 5);
$occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon(), 5);
/** @var Carbon $carbon */
foreach ($occurrences as $carbon) {
$repetitionArray['occurrences'][] = $carbon->toAtomString();
@@ -163,7 +162,6 @@ class RecurrenceTransformer extends AbstractTransformer
// get all transactions:
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions()->get() as $transaction) {
$sourceAccount = $transaction->sourceAccount;
$destinationAccount = $transaction->destinationAccount;
$foreignCurrencyCode = null;
@@ -306,5 +304,4 @@ class RecurrenceTransformer extends AbstractTransformer
return $array;
}
}

View File

@@ -30,7 +30,6 @@ use FireflyIII\Models\RuleGroup;
*/
class RuleGroupTransformer extends AbstractTransformer
{
/**
* Transform the rule group
*

View File

@@ -31,7 +31,6 @@ use FireflyIII\Models\Tag;
*/
class TagTransformer extends AbstractTransformer
{
/**
* Transform a tag.
*
@@ -73,5 +72,4 @@ class TagTransformer extends AbstractTransformer
],
];
}
}

View File

@@ -126,7 +126,7 @@ class TransactionGroupTransformer extends AbstractTransformer
$metaDateData = $this->groupRepos->getMetaDateFields((int) $row['transaction_journal_id'], $this->metaDateFields);
$type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionType::WITHDRAWAL);
$longitude = null;
$latitude = null;
$zoomLevel = null;

View File

@@ -61,5 +61,4 @@ class UserTransformer extends AbstractTransformer
],
];
}
}

View File

@@ -131,8 +131,7 @@ class AccountTransformer extends AbstractTransformer
// get currencies:
$accountIds = $objects->pluck('id')->toArray();
$meta = AccountMeta
::whereIn('account_id', $accountIds)
$meta = AccountMeta::whereIn('account_id', $accountIds)
->where('name', 'currency_id')
->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']);
$currencyIds = $meta->pluck('data')->toArray();

View File

@@ -48,7 +48,7 @@ class BudgetLimitTransformer extends AbstractTransformer
*/
public function includeBudget(BudgetLimit $limit)
{
return $this->item($limit->budget, new BudgetTransformer, 'budgets');
return $this->item($limit->budget, new BudgetTransformer(), 'budgets');
}
/**

View File

@@ -47,7 +47,6 @@ class PreferenceTransformer extends AbstractTransformer
'name' => $preference->name,
'data' => $preference->data,
];
}
/**

View File

@@ -260,7 +260,7 @@ class TransactionGroupTransformer extends AbstractTransformer
*/
private function date(?string $string): ?Carbon
{
if(null === $string) {
if (null === $string) {
return null;
}
return Carbon::createFromFormat('Y-m-d', $string);

View File

@@ -49,5 +49,4 @@ class WebhookAttemptTransformer extends AbstractTransformer
'response' => $attempt->response,
];
}
}

View File

@@ -41,7 +41,6 @@ class WebhookMessageTransformer extends AbstractTransformer
*/
public function transform(WebhookMessage $message): array
{
$json = '{}';
try {
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
@@ -60,5 +59,4 @@ class WebhookMessageTransformer extends AbstractTransformer
'message' => $json,
];
}
}