mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Code cleanup
This commit is contained in:
@@ -74,14 +74,14 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
$this->budgetRepos->setUser($recurrence->user);
|
||||
app('log')->debug('Set user.');
|
||||
|
||||
$shortType = (string)config(sprintf('firefly.transactionTypesToShort.%s', $recurrence->transactionType->type));
|
||||
$shortType = (string) config(sprintf('firefly.transactionTypesToShort.%s', $recurrence->transactionType->type));
|
||||
$notes = $this->repository->getNoteText($recurrence);
|
||||
$reps = 0 === (int)$recurrence->repetitions ? null : (int)$recurrence->repetitions;
|
||||
$reps = 0 === (int) $recurrence->repetitions ? null : (int) $recurrence->repetitions;
|
||||
app('log')->debug('Get basic data.');
|
||||
|
||||
// basic data.
|
||||
return [
|
||||
'id' => (string)$recurrence->id,
|
||||
'id' => (string) $recurrence->id,
|
||||
'created_at' => $recurrence->created_at->toAtomString(),
|
||||
'updated_at' => $recurrence->updated_at->toAtomString(),
|
||||
'type' => $shortType,
|
||||
@@ -117,7 +117,7 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
/** @var RecurrenceRepetition $repetition */
|
||||
foreach ($recurrence->recurrenceRepetitions as $repetition) {
|
||||
$repetitionArray = [
|
||||
'id' => (string)$repetition->id,
|
||||
'id' => (string) $repetition->id,
|
||||
'created_at' => $repetition->created_at->toAtomString(),
|
||||
'updated_at' => $repetition->updated_at->toAtomString(),
|
||||
'type' => $repetition->repetition_type,
|
||||
@@ -164,7 +164,7 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
$foreignCurrencyDp = null;
|
||||
$foreignCurrencyId = null;
|
||||
if (null !== $transaction->foreign_currency_id) {
|
||||
$foreignCurrencyId = (int)$transaction->foreign_currency_id;
|
||||
$foreignCurrencyId = (int) $transaction->foreign_currency_id;
|
||||
$foreignCurrencyCode = $transaction->foreignCurrency->code;
|
||||
$foreignCurrencySymbol = $transaction->foreignCurrency->symbol;
|
||||
$foreignCurrencyDp = $transaction->foreignCurrency->decimal_places;
|
||||
@@ -197,20 +197,20 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
$foreignAmount = app('steam')->bcround($transaction->foreign_amount, $foreignCurrencyDp);
|
||||
}
|
||||
$transactionArray = [
|
||||
'id' => (string)$transaction->id,
|
||||
'currency_id' => (string)$transaction->transaction_currency_id,
|
||||
'id' => (string) $transaction->id,
|
||||
'currency_id' => (string) $transaction->transaction_currency_id,
|
||||
'currency_code' => $transaction->transactionCurrency->code,
|
||||
'currency_symbol' => $transaction->transactionCurrency->symbol,
|
||||
'currency_decimal_places' => $transaction->transactionCurrency->decimal_places,
|
||||
'foreign_currency_id' => null === $foreignCurrencyId ? null : (string)$foreignCurrencyId,
|
||||
'foreign_currency_id' => null === $foreignCurrencyId ? null : (string) $foreignCurrencyId,
|
||||
'foreign_currency_code' => $foreignCurrencyCode,
|
||||
'foreign_currency_symbol' => $foreignCurrencySymbol,
|
||||
'foreign_currency_decimal_places' => $foreignCurrencyDp,
|
||||
'source_id' => (string)$sourceId,
|
||||
'source_id' => (string) $sourceId,
|
||||
'source_name' => $sourceName,
|
||||
'source_iban' => $sourceIban,
|
||||
'source_type' => $sourceType,
|
||||
'destination_id' => (string)$destinationId,
|
||||
'destination_id' => (string) $destinationId,
|
||||
'destination_name' => $destinationName,
|
||||
'destination_iban' => $destinationIban,
|
||||
'destination_type' => $destinationType,
|
||||
@@ -255,9 +255,9 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
throw new FireflyException(sprintf('Recurrence transformer cant handle field "%s"', $transactionMeta->name));
|
||||
|
||||
case 'bill_id':
|
||||
$bill = $this->billRepos->find((int)$transactionMeta->value);
|
||||
$bill = $this->billRepos->find((int) $transactionMeta->value);
|
||||
if (null !== $bill) {
|
||||
$array['bill_id'] = (string)$bill->id;
|
||||
$array['bill_id'] = (string) $bill->id;
|
||||
$array['bill_name'] = $bill->name;
|
||||
}
|
||||
|
||||
@@ -269,18 +269,18 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
break;
|
||||
|
||||
case 'piggy_bank_id':
|
||||
$piggy = $this->piggyRepos->find((int)$transactionMeta->value);
|
||||
$piggy = $this->piggyRepos->find((int) $transactionMeta->value);
|
||||
if (null !== $piggy) {
|
||||
$array['piggy_bank_id'] = (string)$piggy->id;
|
||||
$array['piggy_bank_id'] = (string) $piggy->id;
|
||||
$array['piggy_bank_name'] = $piggy->name;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'category_id':
|
||||
$category = $this->factory->findOrCreate((int)$transactionMeta->value, null);
|
||||
$category = $this->factory->findOrCreate((int) $transactionMeta->value, null);
|
||||
if (null !== $category) {
|
||||
$array['category_id'] = (string)$category->id;
|
||||
$array['category_id'] = (string) $category->id;
|
||||
$array['category_name'] = $category->name;
|
||||
}
|
||||
|
||||
@@ -289,16 +289,16 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
case 'category_name':
|
||||
$category = $this->factory->findOrCreate(null, $transactionMeta->value);
|
||||
if (null !== $category) {
|
||||
$array['category_id'] = (string)$category->id;
|
||||
$array['category_id'] = (string) $category->id;
|
||||
$array['category_name'] = $category->name;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'budget_id':
|
||||
$budget = $this->budgetRepos->find((int)$transactionMeta->value);
|
||||
$budget = $this->budgetRepos->find((int) $transactionMeta->value);
|
||||
if (null !== $budget) {
|
||||
$array['budget_id'] = (string)$budget->id;
|
||||
$array['budget_id'] = (string) $budget->id;
|
||||
$array['budget_name'] = $budget->name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user