Code changes for v540

This commit is contained in:
James Cole
2020-09-18 12:16:47 +02:00
parent 0d72aa9673
commit 706cb47065
36 changed files with 375 additions and 365 deletions

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* DetectedNewIPAddress.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -138,16 +138,16 @@ class ChartJsGenerator implements GeneratorInterface
'type' => $set['type'] ?? 'line',
'data' => array_values($set['entries']),
];
if (isset($set['yAxisID'])) {
if (array_key_exists('yAxisID', $set)) {
$currentSet['yAxisID'] = $set['yAxisID'];
}
if (isset($set['fill'])) {
if (array_key_exists('fill', $set)) {
$currentSet['fill'] = $set['fill'];
}
if (isset($set['currency_symbol'])) {
if (array_key_exists('currency_symbol', $set)) {
$currentSet['currency_symbol'] = $set['currency_symbol'];
}
if (isset($set['backgroundColor'])) {
if (array_key_exists('backgroundColor', $set)) {
$currentSet['backgroundColor'] = $set['backgroundColor'];
}
$chartData['datasets'][] = $currentSet;

View File

@@ -494,7 +494,7 @@ class GroupCollector implements GroupCollectorInterface
private function convertToInteger(array $array): array
{
foreach ($this->integerFields as $field) {
$array[$field] = isset($array[$field]) ? (int) $array[$field] : null;
$array[$field] = array_key_exists($field, $array) ? (int) $array[$field] : null;
}
return $array;
@@ -541,7 +541,7 @@ class GroupCollector implements GroupCollectorInterface
private function mergeAttachments(array $existingJournal, TransactionJournal $newJournal): array
{
$newArray = $newJournal->toArray();
if (isset($newArray['attachment_id'])) {
if (array_key_exists('attachment_id', $newArray)) {
$attachmentId = (int) $newJournal['tag_id'];
$existingJournal['attachments'][$attachmentId] = [
'id' => $attachmentId,
@@ -560,7 +560,7 @@ class GroupCollector implements GroupCollectorInterface
private function mergeTags(array $existingJournal, TransactionJournal $newJournal): array
{
$newArray = $newJournal->toArray();
if (isset($newArray['tag_id'])) { // assume the other fields are present as well.
if (array_key_exists('tag_id', $newArray)) { // assume the other fields are present as well.
$tagId = (int) $newJournal['tag_id'];
$tagDate = null;
@@ -593,7 +593,7 @@ class GroupCollector implements GroupCollectorInterface
foreach ($collection as $augumentedJournal) {
$groupId = $augumentedJournal->transaction_group_id;
if (!isset($groups[$groupId])) {
if (!array_key_exists($groupId, $groups)) {
// make new array
$parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
$groupArray = [
@@ -614,13 +614,13 @@ class GroupCollector implements GroupCollectorInterface
$journalId = (int) $augumentedJournal->transaction_journal_id;
if (isset($groups[$groupId]['transactions'][$journalId])) {
if (array_key_exists($journalId, $groups[$groupId]['transactions'])) {
// append data to existing group + journal (for multiple tags or multiple attachments)
$groups[$groupId]['transactions'][$journalId] = $this->mergeTags($groups[$groupId]['transactions'][$journalId], $augumentedJournal);
$groups[$groupId]['transactions'][$journalId] = $this->mergeAttachments($groups[$groupId]['transactions'][$journalId], $augumentedJournal);
}
if (!isset($groups[$groupId]['transactions'][$journalId])) {
if (!array_key_exists($journalId, $groups[$groupId]['transactions'])) {
// create second, third, fourth split:
$groups[$groupId]['count']++;
$groups[$groupId]['transactions'][$journalId] = $this->parseAugmentedJournal($augumentedJournal);

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* NewIPAddressWarningMail.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Scopes;

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* GetRuleConfiguration.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* OperatorQuerySearch.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* Breadcrumbs.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* RuleEngineInterface.php
* Copyright (c) 2020 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* SearchRuleEngine.php
* Copyright (c) 2020 james@firefly-iii.org