mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Use PSR-12 code style
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -151,5 +151,4 @@ class ShowController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -110,5 +110,4 @@ class UpdateController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user