Various code cleanup.

This commit is contained in:
James Cole
2021-09-18 10:20:19 +02:00
parent 481a6bdd5f
commit 3589c9f60f
137 changed files with 369 additions and 282 deletions

View File

@@ -89,8 +89,8 @@ class PiggyBankTransformer extends AbstractTransformer
// left to save:
$leftToSave = bcsub($piggyBank->targetamount, $currentAmountStr);
$startDate = null === $piggyBank->startdate ? null : $piggyBank->startdate->toAtomString();
$targetDate = null === $piggyBank->targetdate ? null : $piggyBank->targetdate->toAtomString();
$startDate = $piggyBank->startdate?->toAtomString();
$targetDate = $piggyBank->targetdate?->toAtomString();
// target and percentage:
$targetAmount = $piggyBank->targetamount;

View File

@@ -94,8 +94,8 @@ class RecurrenceTransformer extends AbstractTransformer
'title' => $recurrence->title,
'description' => $recurrence->description,
'first_date' => $recurrence->first_date->toAtomString(),
'latest_date' => null === $recurrence->latest_date ? null : $recurrence->latest_date->toAtomString(),
'repeat_until' => null === $recurrence->repeat_until ? null : $recurrence->repeat_until->toAtomString(),
'latest_date' => $recurrence->latest_date?->toAtomString(),
'repeat_until' => $recurrence->repeat_until?->toAtomString(),
'apply_rules' => $recurrence->apply_rules,
'active' => $recurrence->active,
'nr_of_repetitions' => $reps,

View File

@@ -42,7 +42,7 @@ class TagTransformer extends AbstractTransformer
*/
public function transform(Tag $tag): array
{
$date = null === $tag->date ? null : $tag->date->toAtomString();
$date = $tag->date?->toAtomString();
/** @var Location $location */
$location = $tag->locations()->first();
$latitude = null;

View File

@@ -138,7 +138,7 @@ class TransactionGroupTransformer extends AbstractTransformer
return [
'user' => (string)$row['user_id'],
'transaction_journal_id' => (int)$row['transaction_journal_id'],
'transaction_journal_id' => (string)$row['transaction_journal_id'],
'type' => strtolower($type),
'date' => $row['date']->toAtomString(),
'order' => $row['order'],