Mild code cleanup.

This commit is contained in:
James Cole 2023-08-26 18:42:18 +02:00
parent 63297c43b7
commit 66cc3f48bc
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
10 changed files with 85 additions and 79 deletions

View File

@ -379,16 +379,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.22.0",
"version": "v3.23.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "92b019f6c8d79aa26349d0db7671d37440dc0ff3"
"reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/92b019f6c8d79aa26349d0db7671d37440dc0ff3",
"reference": "92b019f6c8d79aa26349d0db7671d37440dc0ff3",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/35af3cbbacfa91e164b252a28ec0b644f1ed4e78",
"reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78",
"shasum": ""
},
"require": {
@ -464,7 +464,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.22.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.23.0"
},
"funding": [
{
@ -472,7 +472,7 @@
"type": "github"
}
],
"time": "2023-07-16T23:08:06+00:00"
"time": "2023-08-14T12:27:35+00:00"
},
{
"name": "psr/cache",
@ -745,16 +745,16 @@
},
{
"name": "symfony/console",
"version": "v6.3.2",
"version": "v6.3.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898"
"reference": "eca495f2ee845130855ddf1cf18460c38966c8b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898",
"reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898",
"url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6",
"reference": "eca495f2ee845130855ddf1cf18460c38966c8b6",
"shasum": ""
},
"require": {
@ -815,7 +815,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v6.3.2"
"source": "https://github.com/symfony/console/tree/v6.3.4"
},
"funding": [
{
@ -831,7 +831,7 @@
"type": "tidelift"
}
],
"time": "2023-07-19T20:17:28+00:00"
"time": "2023-08-16T10:10:12+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -1744,16 +1744,16 @@
},
{
"name": "symfony/process",
"version": "v6.3.2",
"version": "v6.3.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d"
"reference": "0b5c29118f2e980d455d2e34a5659f4579847c54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d",
"reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d",
"url": "https://api.github.com/repos/symfony/process/zipball/0b5c29118f2e980d455d2e34a5659f4579847c54",
"reference": "0b5c29118f2e980d455d2e34a5659f4579847c54",
"shasum": ""
},
"require": {
@ -1785,7 +1785,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.3.2"
"source": "https://github.com/symfony/process/tree/v6.3.4"
},
"funding": [
{
@ -1801,7 +1801,7 @@
"type": "tidelift"
}
],
"time": "2023-07-12T16:00:22+00:00"
"time": "2023-08-07T10:39:22+00:00"
},
{
"name": "symfony/service-contracts",

View File

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

View File

@ -181,8 +181,8 @@ class BudgetLimitHandler
);
// overlap in days:
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);
@ -227,8 +227,8 @@ class BudgetLimitHandler
return '0';
}
$limitPeriod = Period::make(
$budgetLimit->start_date,
$budgetLimit->end_date,
$budgetLimit->start_date,
$budgetLimit->end_date,
precision : Precision::DAY(),
boundaries: Boundaries::EXCLUDE_NONE()
);

View File

@ -138,7 +138,7 @@ class IndexController extends Controller
// get budgeted for default currency:
if (0 === count($availableBudgets)) {
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,);
$budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, );
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency);
$spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0';
unset($spentArr);
@ -197,7 +197,7 @@ class IndexController extends Controller
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
// budgeted in period:
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,);
$budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, );
$array['budgeted'] = $budgeted;
$availableBudgets[] = $array;
unset($spentArr);

View File

@ -87,11 +87,13 @@ class BoxController extends Controller
$availableBudgets = $availableBudgets->filter(
static function (AvailableBudget $availableBudget) use ($currency) {
if ($availableBudget->transaction_currency_id === $currency->id) {
app('log')->debug(sprintf('Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount));
app('log')->debug(sprintf(
'Will include AB #%d: from %s-%s amount %s',
$availableBudget->id,
$availableBudget->start_date->format('Y-m-d'),
$availableBudget->end_date->format('Y-m-d'),
$availableBudget->amount
));
return $availableBudget;
}

View File

@ -43,7 +43,9 @@ class NewAccessToken extends Notification
*
* @return void
*/
public function __construct() {}
public function __construct()
{
}
/**
* Get the array representation of the notification.

View File

@ -1,4 +1,6 @@
<?php
declare(strict_types=1);
/*
* UrlValidator.php
* Copyright (c) 2023 james@firefly-iii.org
@ -26,7 +28,6 @@ namespace FireflyIII\Support\Notifications;
*/
class UrlValidator
{
/**
* @param string $url
*

View File

@ -259,14 +259,14 @@ class OperatorQuerySearch implements SearchInterface
default:
Log::error(sprintf('No such operator: %s', $operator));
throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator));
// some search operators are ignored, basically:
// some search operators are ignored, basically:
case 'user_action':
Log::info(sprintf('Ignore search operator "%s"', $operator));
return false;
//
// all account related searches:
//
//
// all account related searches:
//
case 'account_is':
$this->searchAccount($value, 3, 4);
break;
@ -497,9 +497,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->findNothing();
}
break;
//
// cash account
//
//
// cash account
//
case 'source_is_cash':
$account = $this->getCashAccount();
$this->collector->setSourceAccounts(new Collection([$account]));
@ -524,9 +524,9 @@ class OperatorQuerySearch implements SearchInterface
$account = $this->getCashAccount();
$this->collector->excludeAccounts(new Collection([$account]));
break;
//
// description
//
//
// description
//
case 'description_starts':
$this->collector->descriptionStarts([$value]);
break;
@ -553,9 +553,9 @@ class OperatorQuerySearch implements SearchInterface
case '-description_is':
$this->collector->descriptionIsNot($value);
break;
//
// currency
//
//
// currency
//
case 'currency_is':
$currency = $this->findCurrency($value);
if (null !== $currency) {
@ -592,9 +592,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->findNothing();
}
break;
//
// attachments
//
//
// attachments
//
case 'has_attachments':
case '-has_no_attachments':
Log::debug('Set collector to filter on attachments.');
@ -605,8 +605,8 @@ class OperatorQuerySearch implements SearchInterface
Log::debug('Set collector to filter on NO attachments.');
$this->collector->hasNoAttachments();
break;
//
// categories
//
// categories
case '-has_any_category':
case 'has_no_category':
$this->collector->withoutCategory();
@ -684,9 +684,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->findNothing();
}
break;
//
// budgets
//
//
// budgets
//
case '-has_any_budget':
case 'has_no_budget':
$this->collector->withoutBudget();
@ -765,9 +765,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->findNothing();
}
break;
//
// bill
//
//
// bill
//
case '-has_any_bill':
case 'has_no_bill':
$this->collector->withoutBill();
@ -844,9 +844,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->findNothing();
}
break;
//
// tags
//
//
// tags
//
case '-has_any_tag':
case 'has_no_tag':
$this->collector->withoutTags();
@ -874,9 +874,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->setWithoutSpecificTags($result);
}
break;
//
// notes
//
//
// notes
//
case 'notes_contains':
$this->collector->notesContain($value);
break;
@ -915,9 +915,9 @@ class OperatorQuerySearch implements SearchInterface
case '-reconciled':
$this->collector->isNotReconciled();
break;
//
// amount
//
//
// amount
//
case 'amount_is':
// strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value));
@ -988,9 +988,9 @@ class OperatorQuerySearch implements SearchInterface
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountMore($amount);
break;
//
// transaction type
//
//
// transaction type
//
case 'transaction_type':
$this->collector->setTypes([ucfirst($value)]);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
@ -999,9 +999,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->excludeTypes([ucfirst($value)]);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
break;
//
// dates
//
//
// dates
//
case '-date_on':
case 'date_on':
$range = $this->parseDateRange($operator, $value);
@ -1151,9 +1151,9 @@ class OperatorQuerySearch implements SearchInterface
$range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('updated_at', $range);
return false;
//
// external URL
//
//
// external URL
//
case '-any_external_url':
case 'no_external_url':
$this->collector->withoutExternalUrl();
@ -1196,9 +1196,9 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->externalUrlDoesNotEnd($value);
break;
//
// other fields
//
//
// other fields
//
case 'external_id_is':
$this->collector->setExternalId($value);
break;

View File

@ -302,7 +302,7 @@ class TransactionGroupTransformer extends AbstractTransformer
if (null === $string) {
return null;
}
// Log::debug(sprintf('Now in date("%s")', $string));
// Log::debug(sprintf('Now in date("%s")', $string));
if (10 === strlen($string)) {
return Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
}

View File

@ -204,8 +204,7 @@ trait TransactionValidation
array $transaction,
string $transactionType,
int $index
): void
{
): void {
Log::debug('Now in sanityCheckForeignCurrency()');
if (0 !== $validator->errors()->count()) {
Log::debug('Already have errors, return');