mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Use PSR-12 code style
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,5 +76,4 @@ class AttachmentTransformer extends AbstractTransformer
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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')) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -126,5 +126,4 @@ class BudgetTransformer extends AbstractTransformer
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use FireflyIII\Models\TransactionCurrency;
|
||||
*/
|
||||
class CurrencyTransformer extends AbstractTransformer
|
||||
{
|
||||
|
||||
/**
|
||||
* Transform the currency.
|
||||
*
|
||||
|
||||
@@ -69,5 +69,4 @@ class ObjectGroupTransformer extends AbstractTransformer
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,5 +98,4 @@ class PiggyBankEventTransformer extends AbstractTransformer
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,5 @@ class PreferenceTransformer extends AbstractTransformer
|
||||
'name' => $preference->name,
|
||||
'data' => $preference->data,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ use FireflyIII\Models\RuleGroup;
|
||||
*/
|
||||
class RuleGroupTransformer extends AbstractTransformer
|
||||
{
|
||||
|
||||
/**
|
||||
* Transform the rule group
|
||||
*
|
||||
|
||||
@@ -31,7 +31,6 @@ use FireflyIII\Models\Tag;
|
||||
*/
|
||||
class TagTransformer extends AbstractTransformer
|
||||
{
|
||||
|
||||
/**
|
||||
* Transform a tag.
|
||||
*
|
||||
@@ -73,5 +72,4 @@ class TagTransformer extends AbstractTransformer
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -61,5 +61,4 @@ class UserTransformer extends AbstractTransformer
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,6 @@ class PreferenceTransformer extends AbstractTransformer
|
||||
'name' => $preference->name,
|
||||
'data' => $preference->data,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -49,5 +49,4 @@ class WebhookAttemptTransformer extends AbstractTransformer
|
||||
'response' => $attempt->response,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user