Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:23:00 +01:00
parent b27fe59ab4
commit 1667b88dcd
154 changed files with 277 additions and 322 deletions

View File

@@ -84,12 +84,12 @@ class DestroyController extends Controller
// grab asset account(s) from group:
$accounts = [];
/** @var TransactionJournal $journal */
foreach($transactionGroup->transactionJournals as $journal) {
foreach ($transactionGroup->transactionJournals as $journal) {
/** @var Transaction $transaction */
foreach($journal->transactions as $transaction) {
foreach ($journal->transactions as $transaction) {
$type = $transaction->account->accountType->type;
// if is valid liability, trigger event!
if(in_array($type, config('firefly.valid_liabilities'))) {
if (in_array($type, config('firefly.valid_liabilities'), true)) {
$accounts[] = $transaction->account;
}
}
@@ -102,7 +102,7 @@ class DestroyController extends Controller
app('preferences')->mark();
/** @var Account $account */
foreach($accounts as $account) {
foreach ($accounts as $account) {
Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
event(new UpdatedAccount($account));
}

View File

@@ -80,7 +80,7 @@ class ListController extends Controller
{
$manager = $this->getManager();
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$collection = new Collection;
$collection = new Collection();
foreach ($transactionGroup->transactionJournals as $transactionJournal) {
$collection = $this->journalAPIRepository->getAttachments($transactionJournal)->merge($collection);
}
@@ -115,7 +115,7 @@ class ListController extends Controller
public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse
{
$manager = $this->getManager();
$collection = new Collection;
$collection = new Collection();
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
foreach ($transactionGroup->transactionJournals as $transactionJournal) {
$collection = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal)->merge($collection);

View File

@@ -151,5 +151,4 @@ class ShowController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
}

View File

@@ -95,14 +95,15 @@ class StoreController extends Controller
} catch (DuplicateTransactionException $e) {
Log::warning('Caught a duplicate transaction. Return error message.');
$validator = Validator::make(
['transactions' => [['description' => $e->getMessage()]]], ['transactions.0.description' => new IsDuplicateTransaction]
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator, 0, $e);
} catch (FireflyException $e) {
Log::warning('Caught an exception. Return error message.');
Log::error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction]);
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator, 0, $e);
}
app('preferences')->mark();

View File

@@ -110,5 +110,4 @@ class UpdateController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
}