Code for new release

This commit is contained in:
James Cole
2023-07-15 16:02:42 +02:00
parent f43b539470
commit b557805eeb
213 changed files with 1942 additions and 1426 deletions

View File

@@ -1,4 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ phpmd.xml
~ Copyright (c) 2023 james@firefly-iii.org
~
~ This file is part of Firefly III (https://github.com/firefly-iii).
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ruleset name="pcsg-generated-ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* ShowController.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\Budget;
use FireflyIII\Api\V2\Controllers\Controller;
@@ -42,8 +44,7 @@ class ShowController extends Controller
/**
*
*/
public function __construct()
{
public function __construct() {
parent::__construct();
$this->middleware(
function ($request, $next) {
@@ -59,8 +60,7 @@ class ShowController extends Controller
* TODO add URL
*
*/
public function budgeted(DateRequest $request, Budget $budget): JsonResponse
{
public function budgeted(DateRequest $request, Budget $budget): JsonResponse {
$data = $request->getAll();
$result = $this->repository->budgetedInPeriodForBudget($budget, $data['start'], $data['end']);
$converted = $this->cerSum(array_values($result));
@@ -73,8 +73,7 @@ class ShowController extends Controller
* TODO add URL
*
*/
public function spent(DateRequest $request, Budget $budget): JsonResponse
{
public function spent(DateRequest $request, Budget $budget): JsonResponse {
$data = $request->getAll();
$result = $this->repository->spentInPeriodForBudget($budget, $data['start'], $data['end']);
$converted = $this->cerSum(array_values($result));

View File

@@ -126,6 +126,7 @@ class CorrectOpeningBalanceCurrencies extends Command
/**
* @param Account $account
* @param TransactionJournal $journal
*
* @return int
*/
private function setCorrectCurrency(Account $account, TransactionJournal $journal): int

View File

@@ -1,5 +1,26 @@
<?php
/*
* TriggerCreditCalculation.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction;

View File

@@ -75,6 +75,7 @@ class UpdateGroupInformation extends Command
/**
* @param User $user
*
* @return void
*/
private function updateGroupInfo(User $user): void

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* ShowsFriendlyMessages.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
/**
@@ -30,55 +32,55 @@ trait ShowsFriendlyMessages
{
/**
* @param string $message
*
* @return void
*/
public function friendlyError(string $message): void
{
public function friendlyError(string $message): void {
$this->error(sprintf(' [x] %s', trim($message)));
}
/**
* @param string $message
*
* @return void
*/
public function friendlyInfo(string $message): void
{
public function friendlyInfo(string $message): void {
$this->friendlyNeutral($message);
}
/**
* @param string $message
*
* @return void
*/
public function friendlyNeutral(string $message): void
{
public function friendlyNeutral(string $message): void {
$this->line(sprintf(' [i] %s', trim($message)));
}
/**
* @param string $message
*
* @return void
*/
public function friendlyLine(string $message): void
{
public function friendlyLine(string $message): void {
$this->line(sprintf(' %s', trim($message)));
}
/**
* @param string $message
*
* @return void
*/
public function friendlyPositive(string $message): void
{
public function friendlyPositive(string $message): void {
$this->info(sprintf(' [✓] %s', trim($message)));
}
/**
* @param string $message
*
* @return void
*/
public function friendlyWarning(string $message): void
{
public function friendlyWarning(string $message): void {
$this->warn(sprintf(' [!] %s', trim($message)));
}

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

View File

@@ -25,7 +25,6 @@ namespace FireflyIII\Console\Commands\Upgrade;
use DB;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Transaction;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Console\Command;

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceMeta;
use FireflyIII\Models\RecurrenceTransactionMeta;

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceTransaction;
use FireflyIII\Models\TransactionType;
@@ -103,6 +102,7 @@ class MigrateRecurrenceType extends Command
/**
* @param Recurrence $recurrence
*
* @return void
*/
private function migrateRecurrence(Recurrence $recurrence): void

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Location;
use FireflyIII\Models\Tag;
use Illuminate\Console\Command;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\AccountMetaFactory;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;

View File

@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* Created.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events\Model\BudgetLimit;
use FireflyIII\Events\Event;
@@ -39,8 +41,7 @@ class Created extends Event
/**
* @param BudgetLimit $budgetLimit
*/
public function __construct(BudgetLimit $budgetLimit)
{
public function __construct(BudgetLimit $budgetLimit) {
$this->budgetLimit = $budgetLimit;
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/*
* Created.php
* Deleted.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events\Model\BudgetLimit;
use FireflyIII\Events\Event;
@@ -39,8 +41,7 @@ class Deleted extends Event
/**
* @param BudgetLimit $budgetLimit
*/
public function __construct(BudgetLimit $budgetLimit)
{
public function __construct(BudgetLimit $budgetLimit) {
$this->budgetLimit = $budgetLimit;
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/*
* Created.php
* Updated.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Events\Model\BudgetLimit;
use FireflyIII\Events\Event;
@@ -39,8 +41,7 @@ class Updated extends Event
/**
* @param BudgetLimit $budgetLimit
*/
public function __construct(BudgetLimit $budgetLimit)
{
public function __construct(BudgetLimit $budgetLimit) {
$this->budgetLimit = $budgetLimit;
}
}

View File

@@ -416,6 +416,7 @@ class TransactionJournalFactory
/**
* @param Account|null $sourceAccount
* @param Account|null $destinationAccount
*
* @return array
*/
private function reconciliationSanityCheck(?Account $sourceAccount, ?Account $destinationAccount): array

View File

@@ -58,6 +58,7 @@ interface MessageGeneratorInterface
/**
* @param Collection $webhooks
*
* @return void
*/
public function setWebhooks(Collection $webhooks): void;

View File

@@ -103,6 +103,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
/**
* @param Webhook $webhook
*
* @throws FireflyException
* @throws JsonException
*/
@@ -118,6 +119,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
/**
* @param Webhook $webhook
* @param Model $model
*
* @throws FireflyException
* @throws JsonException
*/

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Notifications\User\NewAccessToken;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Support\Facades\Log;

View File

@@ -42,6 +42,7 @@ class AdminEventHandler
{
/**
* @param InvitationCreated $event
*
* @return void
*/
public function sendInvitationNotification(InvitationCreated $event): void
@@ -79,6 +80,7 @@ class AdminEventHandler
* Send new version message to admin.
*
* @param NewVersionAvailable $event
*
* @return void
*/
public function sendNewVersion(NewVersionAvailable $event): void

View File

@@ -42,6 +42,7 @@ class AutomationHandler
* Respond to the creation of X journals.
*
* @param RequestedReportOnJournals $event
*
* @throws FireflyException
*/
public function reportJournals(RequestedReportOnJournals $event): void

View File

@@ -38,6 +38,7 @@ class BillEventHandler
{
/**
* @param WarnUserAboutBill $event
*
* @return void
*/
public function warnAboutBill(WarnUserAboutBill $event): void

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* BudgetLimitHandler.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Handlers\Events\Model;
use FireflyIII\Events\Model\BudgetLimit\Created;
@@ -44,20 +46,20 @@ class BudgetLimitHandler
{
/**
* @param Created $event
*
* @return void
*/
public function created(Created $event): void
{
public function created(Created $event): void {
Log::debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
$this->updateAvailableBudget($event->budgetLimit);
}
/**
* @param BudgetLimit $budgetLimit
*
* @return void
*/
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
{
private function updateAvailableBudget(BudgetLimit $budgetLimit): void {
Log::debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
// based on the view range of the user (month week quarter etc) the budget limit could
@@ -140,10 +142,10 @@ class BudgetLimitHandler
/**
* @param AvailableBudget $availableBudget
*
* @return void
*/
private function calculateAmount(AvailableBudget $availableBudget): void
{
private function calculateAmount(AvailableBudget $availableBudget): void {
$repository = app(BudgetLimitRepositoryInterface::class);
$repository->setUser($availableBudget->user);
$newAmount = '0';
@@ -205,10 +207,10 @@ class BudgetLimitHandler
/**
* @param BudgetLimit $budgetLimit
*
* @return string
*/
private function getDailyAmount(BudgetLimit $budgetLimit): string
{
private function getDailyAmount(BudgetLimit $budgetLimit): string {
if (0 === (int)$budgetLimit->id) {
return '0';
}
@@ -228,10 +230,10 @@ class BudgetLimitHandler
/**
* @param Deleted $event
*
* @return void
*/
public function deleted(Deleted $event): void
{
public function deleted(Deleted $event): void {
Log::debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
$budgetLimit = $event->budgetLimit;
$budgetLimit->id = null;
@@ -240,10 +242,10 @@ class BudgetLimitHandler
/**
* @param Updated $event
*
* @return void
*/
public function updated(Updated $event): void
{
public function updated(Updated $event): void {
Log::debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
$this->updateAvailableBudget($event->budgetLimit);
}

View File

@@ -329,6 +329,7 @@ class UserEventHandler
/**
* @param InvitationCreated $event
*
* @return void
* @throws FireflyException
*/
@@ -376,6 +377,7 @@ class UserEventHandler
/**
* @param ActuallyLoggedIn $event
*
* @throws FireflyException
*/
public function storeUserIPAddress(ActuallyLoggedIn $event): void

View File

@@ -38,6 +38,7 @@ trait AttachmentCollection
{
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameContains(string $name): GroupCollectorInterface
@@ -116,6 +117,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotContain(string $name): GroupCollectorInterface
@@ -145,6 +147,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotEnd(string $name): GroupCollectorInterface
@@ -174,6 +177,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface
@@ -203,6 +207,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameEnds(string $name): GroupCollectorInterface
@@ -232,6 +237,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameIs(string $name): GroupCollectorInterface
@@ -258,6 +264,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameIsNot(string $name): GroupCollectorInterface
@@ -284,6 +291,7 @@ trait AttachmentCollection
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameStarts(string $name): GroupCollectorInterface
@@ -313,6 +321,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesAre(string $value): GroupCollectorInterface
@@ -339,6 +348,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesAreNot(string $value): GroupCollectorInterface
@@ -365,6 +375,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesContains(string $value): GroupCollectorInterface
@@ -391,6 +402,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotContain(string $value): GroupCollectorInterface
@@ -417,6 +429,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotEnd(string $value): GroupCollectorInterface
@@ -443,6 +456,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotStart(string $value): GroupCollectorInterface
@@ -469,6 +483,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface
@@ -495,6 +510,7 @@ trait AttachmentCollection
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface

View File

@@ -320,6 +320,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlContains(string $url): GroupCollectorInterface
@@ -335,6 +336,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface
@@ -350,6 +352,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
@@ -365,6 +368,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
@@ -382,6 +386,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlEnds(string $url): GroupCollectorInterface
@@ -397,6 +402,7 @@ trait MetaCollection
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlStarts(string $url): GroupCollectorInterface

View File

@@ -34,6 +34,7 @@ trait TimeCollection
{
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayAfter(string $day): GroupCollectorInterface
@@ -44,6 +45,7 @@ trait TimeCollection
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayBefore(string $day): GroupCollectorInterface
@@ -54,6 +56,7 @@ trait TimeCollection
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayIs(string $day): GroupCollectorInterface
@@ -64,6 +67,7 @@ trait TimeCollection
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayIsNot(string $day): GroupCollectorInterface
@@ -76,6 +80,7 @@ trait TimeCollection
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
@@ -118,6 +123,7 @@ trait TimeCollection
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function excludeObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
@@ -134,6 +140,7 @@ trait TimeCollection
/**
* @param Carbon $start
* @param Carbon $end
*
* @return GroupCollectorInterface
*/
public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface
@@ -153,6 +160,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayAfter(string $day, string $field): GroupCollectorInterface
@@ -176,6 +184,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayBefore(string $day, string $field): GroupCollectorInterface
@@ -199,6 +208,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayIs(string $day, string $field): GroupCollectorInterface
@@ -221,6 +231,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface
@@ -243,6 +254,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthAfter(string $month, string $field): GroupCollectorInterface
@@ -266,6 +278,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthBefore(string $month, string $field): GroupCollectorInterface
@@ -289,6 +302,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthIs(string $month, string $field): GroupCollectorInterface
@@ -311,6 +325,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface
@@ -333,6 +348,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearAfter(string $year, string $field): GroupCollectorInterface
@@ -356,6 +372,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearBefore(string $year, string $field): GroupCollectorInterface
@@ -379,6 +396,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearIs(string $year, string $field): GroupCollectorInterface
@@ -402,6 +420,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface
@@ -423,6 +442,7 @@ trait TimeCollection
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthAfter(string $month): GroupCollectorInterface
@@ -433,6 +453,7 @@ trait TimeCollection
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthBefore(string $month): GroupCollectorInterface
@@ -443,6 +464,7 @@ trait TimeCollection
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthIs(string $month): GroupCollectorInterface
@@ -453,6 +475,7 @@ trait TimeCollection
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthIsNot(string $month): GroupCollectorInterface
@@ -464,6 +487,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayAfter(string $day, string $field): GroupCollectorInterface
@@ -475,6 +499,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayBefore(string $day, string $field): GroupCollectorInterface
@@ -486,6 +511,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayIs(string $day, string $field): GroupCollectorInterface
@@ -497,6 +523,7 @@ trait TimeCollection
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayIsNot(string $day, string $field): GroupCollectorInterface
@@ -508,6 +535,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthAfter(string $month, string $field): GroupCollectorInterface
@@ -519,6 +547,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthBefore(string $month, string $field): GroupCollectorInterface
@@ -530,6 +559,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthIs(string $month, string $field): GroupCollectorInterface
@@ -541,6 +571,7 @@ trait TimeCollection
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthIsNot(string $month, string $field): GroupCollectorInterface
@@ -552,6 +583,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearAfter(string $year, string $field): GroupCollectorInterface
@@ -563,6 +595,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearBefore(string $year, string $field): GroupCollectorInterface
@@ -574,6 +607,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearIs(string $year, string $field): GroupCollectorInterface
@@ -585,6 +619,7 @@ trait TimeCollection
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearIsNot(string $year, string $field): GroupCollectorInterface
@@ -643,6 +678,7 @@ trait TimeCollection
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setMetaAfter(Carbon $date, string $field): GroupCollectorInterface
@@ -667,6 +703,7 @@ trait TimeCollection
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface
@@ -691,6 +728,7 @@ trait TimeCollection
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
@@ -720,6 +758,7 @@ trait TimeCollection
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectAfter(Carbon $date, string $field): GroupCollectorInterface
@@ -733,6 +772,7 @@ trait TimeCollection
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectBefore(Carbon $date, string $field): GroupCollectorInterface
@@ -746,6 +786,7 @@ trait TimeCollection
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface
@@ -800,6 +841,7 @@ trait TimeCollection
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearAfter(string $year): GroupCollectorInterface
@@ -810,6 +852,7 @@ trait TimeCollection
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearBefore(string $year): GroupCollectorInterface
@@ -820,6 +863,7 @@ trait TimeCollection
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearIs(string $year): GroupCollectorInterface
@@ -830,6 +874,7 @@ trait TimeCollection
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearIsNot(string $year): GroupCollectorInterface

View File

@@ -664,6 +664,7 @@ class GroupCollector implements GroupCollectorInterface
/**
* @param array $array
*
* @return array
*/
private function convertToStrings(array $array): array
@@ -772,6 +773,7 @@ class GroupCollector implements GroupCollectorInterface
/**
* @param Collection $collection
*
* @return Collection
*/
private function postFilterCollection(Collection $collection): Collection

View File

@@ -75,120 +75,140 @@ interface GroupCollectorInterface
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameContains(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotContain(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotEnd(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameEnds(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameIs(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameIsNot(string $name): GroupCollectorInterface;
/**
* @param string $name
*
* @return GroupCollectorInterface
*/
public function attachmentNameStarts(string $name): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesAre(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesAreNot(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesContains(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotContain(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotEnd(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesDoNotStart(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface;
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayAfter(string $day): GroupCollectorInterface;
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayBefore(string $day): GroupCollectorInterface;
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayIs(string $day): GroupCollectorInterface;
/**
* @param string $day
*
* @return GroupCollectorInterface
*/
public function dayIsNot(string $day): GroupCollectorInterface;
@@ -287,6 +307,7 @@ interface GroupCollectorInterface
* Exclude a set of categories.
*
* @param Collection $categories
*
* @return GroupCollectorInterface
*/
public function excludeCategories(Collection $categories): GroupCollectorInterface;
@@ -329,6 +350,7 @@ interface GroupCollectorInterface
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function excludeExternalUrl(string $url): GroupCollectorInterface;
@@ -373,6 +395,7 @@ interface GroupCollectorInterface
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
@@ -381,6 +404,7 @@ interface GroupCollectorInterface
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function excludeObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
@@ -388,6 +412,7 @@ interface GroupCollectorInterface
/**
* @param Carbon $start
* @param Carbon $end
*
* @return GroupCollectorInterface
*/
public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface;
@@ -433,72 +458,84 @@ interface GroupCollectorInterface
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdContains(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdEnds(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function externalIdStarts(string $externalId): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlContains(string $url): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlEnds(string $url): GroupCollectorInterface;
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function externalUrlStarts(string $url): GroupCollectorInterface;
@@ -588,36 +625,42 @@ interface GroupCollectorInterface
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceContains(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceDoesNotContain(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceDoesNotEnd(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceEnds(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function internalReferenceStarts(string $externalId): GroupCollectorInterface;
@@ -639,6 +682,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayAfter(string $day, string $field): GroupCollectorInterface;
@@ -646,6 +690,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayBefore(string $day, string $field): GroupCollectorInterface;
@@ -653,6 +698,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayIs(string $day, string $field): GroupCollectorInterface;
@@ -660,6 +706,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaDayIsNot(string $day, string $field): GroupCollectorInterface;
@@ -667,6 +714,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthAfter(string $month, string $field): GroupCollectorInterface;
@@ -674,6 +722,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthBefore(string $month, string $field): GroupCollectorInterface;
@@ -681,6 +730,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthIs(string $month, string $field): GroupCollectorInterface;
@@ -688,6 +738,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface;
@@ -695,6 +746,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearAfter(string $year, string $field): GroupCollectorInterface;
@@ -702,6 +754,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearBefore(string $year, string $field): GroupCollectorInterface;
@@ -709,6 +762,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearIs(string $year, string $field): GroupCollectorInterface;
@@ -716,30 +770,35 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function metaYearIsNot(string $year, string $field): GroupCollectorInterface;
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthAfter(string $month): GroupCollectorInterface;
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthBefore(string $month): GroupCollectorInterface;
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthIs(string $month): GroupCollectorInterface;
/**
* @param string $month
*
* @return GroupCollectorInterface
*/
public function monthIsNot(string $month): GroupCollectorInterface;
@@ -767,6 +826,7 @@ interface GroupCollectorInterface
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesDontStartWith(string $value): GroupCollectorInterface;
@@ -802,6 +862,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayAfter(string $day, string $field): GroupCollectorInterface;
@@ -809,6 +870,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayBefore(string $day, string $field): GroupCollectorInterface;
@@ -816,6 +878,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayIs(string $day, string $field): GroupCollectorInterface;
@@ -823,6 +886,7 @@ interface GroupCollectorInterface
/**
* @param string $day
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectDayIsNot(string $day, string $field): GroupCollectorInterface;
@@ -830,6 +894,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthAfter(string $month, string $field): GroupCollectorInterface;
@@ -837,6 +902,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthBefore(string $month, string $field): GroupCollectorInterface;
@@ -844,6 +910,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthIs(string $month, string $field): GroupCollectorInterface;
@@ -851,6 +918,7 @@ interface GroupCollectorInterface
/**
* @param string $month
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectMonthIsNot(string $month, string $field): GroupCollectorInterface;
@@ -858,6 +926,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearAfter(string $year, string $field): GroupCollectorInterface;
@@ -865,6 +934,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearBefore(string $year, string $field): GroupCollectorInterface;
@@ -872,6 +942,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearIs(string $year, string $field): GroupCollectorInterface;
@@ -879,6 +950,7 @@ interface GroupCollectorInterface
/**
* @param string $year
* @param string $field
*
* @return GroupCollectorInterface
*/
public function objectYearIsNot(string $year, string $field): GroupCollectorInterface;
@@ -1011,6 +1083,7 @@ interface GroupCollectorInterface
/**
* @param string $url
*
* @return GroupCollectorInterface
*/
public function setExternalUrl(string $url): GroupCollectorInterface;
@@ -1065,6 +1138,7 @@ interface GroupCollectorInterface
*
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setMetaAfter(Carbon $date, string $field): GroupCollectorInterface;
@@ -1074,6 +1148,7 @@ interface GroupCollectorInterface
*
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface;
@@ -1101,6 +1176,7 @@ interface GroupCollectorInterface
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectAfter(Carbon $date, string $field): GroupCollectorInterface;
@@ -1108,6 +1184,7 @@ interface GroupCollectorInterface
/**
* @param Carbon $date
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectBefore(Carbon $date, string $field): GroupCollectorInterface;
@@ -1116,6 +1193,7 @@ interface GroupCollectorInterface
* @param Carbon $start
* @param Carbon $end
* @param string $field
*
* @return GroupCollectorInterface
*/
public function setObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface;
@@ -1159,6 +1237,7 @@ interface GroupCollectorInterface
/**
* @param string $sepaCT
*
* @return GroupCollectorInterface
*/
public function setSepaCT(string $sepaCT): GroupCollectorInterface;
@@ -1332,6 +1411,7 @@ interface GroupCollectorInterface
* Transaction must have meta date field X.
*
* @param string $field
*
* @return GroupCollectorInterface
*/
public function withMetaDate(string $field): GroupCollectorInterface;
@@ -1397,24 +1477,28 @@ interface GroupCollectorInterface
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearAfter(string $year): GroupCollectorInterface;
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearBefore(string $year): GroupCollectorInterface;
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearIs(string $year): GroupCollectorInterface;
/**
* @param string $year
*
* @return GroupCollectorInterface
*/
public function yearIsNot(string $year): GroupCollectorInterface;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Helpers\Fiscal;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

View File

@@ -49,6 +49,7 @@ interface NetWorthInterface
*
* @param Collection $accounts
* @param Carbon $date
*
* @return array
* @deprecated
*/

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Requests\ConfigurationRequest;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Events\AdminRequestedTestMessage;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Support\Facades\FireflyConfig;
@@ -84,6 +83,7 @@ class HomeController extends Controller
/**
* @param Request $request
*
* @return RedirectResponse
*/
public function notifications(Request $request): RedirectResponse

View File

@@ -89,6 +89,7 @@ class UserController extends Controller
/**
* @param InvitedUser $invitedUser
*
* @return JsonResponse
*/
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
@@ -192,6 +193,7 @@ class UserController extends Controller
/**
* @param InviteUserFormRequest $request
*
* @return RedirectResponse
*/
public function invite(InviteUserFormRequest $request): RedirectResponse

View File

@@ -35,7 +35,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
use JsonException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

View File

@@ -517,6 +517,7 @@ class AccountController extends Controller
*
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Helpers\Report\NetWorthInterface;

View File

@@ -208,6 +208,7 @@ class CurrencyController extends Controller
/**
* @param Request $request
*
* @return JsonResponse
* @throws FireflyException
*/
@@ -300,6 +301,7 @@ class CurrencyController extends Controller
/**
* @param Request $request
*
* @return JsonResponse
*/
public function enableCurrency(Request $request): JsonResponse

View File

@@ -32,8 +32,6 @@ use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class RecurrenceController

View File

@@ -1,5 +1,26 @@
<?php
/*
* TriggerController.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
/*
* TriggerController.php
@@ -41,6 +62,7 @@ class TriggerController extends Controller
/**
* @param Recurrence $recurrence
* @param TriggerRecurrenceRequest $request
*
* @return RedirectResponse
*/
public function trigger(Recurrence $recurrence, TriggerRecurrenceRequest $request): RedirectResponse

View File

@@ -45,8 +45,8 @@ class BillController extends Controller
* @return mixed|string
* @throws FireflyException
*/
public function overview(Collection $accounts, Carbon $start, Carbon $end)
{ // chart properties for cache:
public function overview(Collection $accounts, Carbon $start, Carbon $end) // chart properties for cache:
{
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);

View File

@@ -241,6 +241,7 @@ class CreateController extends Controller
/**
* @param Request $request
*
* @return JsonResponse
*/
public function duplicate(Request $request): JsonResponse

View File

@@ -138,6 +138,7 @@ class InstallController extends Controller
/**
* @param string $command
* @param array $args
*
* @return bool
* @throws FireflyException
*/

View File

@@ -155,6 +155,7 @@ class LinkController extends Controller
* Switch link from A <> B to B <> A.
*
* @param Request $request
*
* @return RedirectResponse|Redirector
*/
public function switchLink(Request $request)

View File

@@ -39,6 +39,7 @@ class AcceptHeaders
*
* @param Request $request
* @param callable $next
*
* @return Response
* @throws BadHttpHeaderException
*/
@@ -78,6 +79,7 @@ class AcceptHeaders
/**
* @param string $content
* @param array $accepted
*
* @return bool
*/
private function acceptsHeader(string $content, array $accepted): bool

View File

@@ -121,6 +121,7 @@ class Authenticate
/**
* @param User|null $user
* @param array $guards
*
* @return void
* @throws AuthenticationException
*/

View File

@@ -86,6 +86,7 @@ class RuleFormRequest extends FormRequest
/**
* @param array $array
*
* @return array
*/
public static function replaceAmountTrigger(array $array): array

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types=1);
/*
* TriggerRecurrenceRequest.php
* Copyright (c) 2022 james@firefly-iii.org
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Requests;
use FireflyIII\Support\Request\ChecksLogin;
@@ -40,8 +42,7 @@ class TriggerRecurrenceRequest extends FormRequest
*
* @return array
*/
public function getAll(): array
{
public function getAll(): array {
return [
'date' => $this->getCarbonDate('date'),
];
@@ -52,8 +53,7 @@ class TriggerRecurrenceRequest extends FormRequest
*
* @return array
*/
public function rules(): array
{
public function rules(): array {
return [
'date' => 'required|date',
];

View File

@@ -314,6 +314,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
/**
* @param AutoBudget $autoBudget
*
* @return void
*/
private function createAdjustedLimit(AutoBudget $autoBudget): void

View File

@@ -94,6 +94,7 @@ class DownloadExchangeRates implements ShouldQueue
/**
* @param TransactionCurrency $currency
*
* @return void
* @throws GuzzleException
*/
@@ -128,6 +129,7 @@ class DownloadExchangeRates implements ShouldQueue
* @param TransactionCurrency $currency
* @param Carbon $date
* @param array $rates
*
* @return void
*/
private function saveRates(TransactionCurrency $currency, Carbon $date, array $rates): void
@@ -145,6 +147,7 @@ class DownloadExchangeRates implements ShouldQueue
/**
* @param string $code
*
* @return TransactionCurrency|null
*/
private function getCurrency(string $code): ?TransactionCurrency
@@ -177,6 +180,7 @@ class DownloadExchangeRates implements ShouldQueue
* @param TransactionCurrency $to
* @param Carbon $date
* @param float $rate
*
* @return void
*/
private function saveRate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date, float $rate): void

View File

@@ -97,6 +97,7 @@ class WarnAboutBills implements ShouldQueue
/**
* @param Bill $bill
*
* @return bool
*/
private function hasDateFields(Bill $bill): bool
@@ -115,6 +116,7 @@ class WarnAboutBills implements ShouldQueue
/**
* @param Bill $bill
* @param string $field
*
* @return bool
*/
private function needsWarning(Bill $bill, string $field): bool
@@ -134,6 +136,7 @@ class WarnAboutBills implements ShouldQueue
/**
* @param Bill $bill
* @param string $field
*
* @return int
*/
private function getDiff(Bill $bill, string $field): int
@@ -146,6 +149,7 @@ class WarnAboutBills implements ShouldQueue
/**
* @param Bill $bill
* @param string $field
*
* @return void
*/
private function sendWarning(Bill $bill, string $field): void

View File

@@ -52,6 +52,7 @@ class TestNotification extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -65,6 +66,7 @@ class TestNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -78,6 +80,7 @@ class TestNotification extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -89,6 +92,7 @@ class TestNotification extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -53,6 +53,7 @@ class UserInvitation extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -66,6 +67,7 @@ class UserInvitation extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -79,6 +81,7 @@ class UserInvitation extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -92,6 +95,7 @@ class UserInvitation extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -53,6 +53,7 @@ class UserRegistration extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -66,6 +67,7 @@ class UserRegistration extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -79,6 +81,7 @@ class UserRegistration extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -90,6 +93,7 @@ class UserRegistration extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -53,6 +53,7 @@ class VersionCheckResult extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -66,6 +67,7 @@ class VersionCheckResult extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -79,6 +81,7 @@ class VersionCheckResult extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -93,6 +96,7 @@ class VersionCheckResult extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -57,6 +57,7 @@ class BillReminder extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -70,6 +71,7 @@ class BillReminder extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -88,6 +90,7 @@ class BillReminder extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -110,6 +113,7 @@ class BillReminder extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -49,6 +49,7 @@ class NewAccessToken extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -62,6 +63,7 @@ class NewAccessToken extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -75,6 +77,7 @@ class NewAccessToken extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -86,6 +89,7 @@ class NewAccessToken extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -51,6 +51,7 @@ class TransactionCreation extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -64,6 +65,7 @@ class TransactionCreation extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -77,6 +79,7 @@ class TransactionCreation extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -54,6 +54,7 @@ class UserLogin extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -67,6 +68,7 @@ class UserLogin extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -92,6 +94,7 @@ class UserLogin extends Notification
* Get the Slack representation of the notification.
*
* @param mixed $notifiable
*
* @return SlackMessage
*/
public function toSlack($notifiable)
@@ -114,6 +117,7 @@ class UserLogin extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -51,6 +51,7 @@ class UserNewPassword extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -64,6 +65,7 @@ class UserNewPassword extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -77,6 +79,7 @@ class UserNewPassword extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -48,6 +48,7 @@ class UserRegistration extends Notification
* Get the array representation of the notification.
*
* @param mixed $notifiable
*
* @return array
*/
public function toArray($notifiable)
@@ -61,6 +62,7 @@ class UserRegistration extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
*
* @return MailMessage
*/
public function toMail($notifiable)
@@ -74,6 +76,7 @@ class UserRegistration extends Notification
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @return array
*/
public function via($notifiable)

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* AccountRepository.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\Administration\Account;
use FireflyIII\Support\Repositories\Administration\AdministrationTrait;
@@ -36,8 +38,7 @@ class AccountRepository implements AccountRepositoryInterface
/**
* @inheritDoc
*/
public function searchAccount(string $query, array $types, int $limit): Collection
{
public function searchAccount(string $query, array $types, int $limit): Collection {
// search by group, not by user
$dbQuery = $this->userGroup->accounts()
->where('active', true)

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
/*
* AccountRepositoryInterface.php
* Copyright (c) 2023 james@firefly-iii.org
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\Administration\Account;
use Illuminate\Support\Collection;

View File

@@ -35,12 +35,14 @@ interface ALERepositoryInterface
{
/**
* @param Model $model
*
* @return Collection
*/
public function getForObject(Model $model): Collection;
/**
* @param array $data
*
* @return AuditLogEntry
*/
public function store(array $data): AuditLogEntry;

View File

@@ -282,6 +282,7 @@ interface BillRepositoryInterface
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function sumPaidInRange(Carbon $start, Carbon $end): array;
@@ -291,6 +292,7 @@ interface BillRepositoryInterface
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function sumUnpaidInRange(Carbon $start, Carbon $end): array;

View File

@@ -171,6 +171,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param BudgetLimit $limit
* @param Carbon $start
* @param Carbon $end
*
* @return int
*/
private function daysInOverlap(BudgetLimit $limit, Carbon $start, Carbon $end): int
@@ -374,6 +375,7 @@ class BudgetRepository implements BudgetRepositoryInterface
/**
* @param Budget $budget
* @param string $text
*
* @return void
*/
private function setNoteText(Budget $budget, string $text): void
@@ -405,6 +407,7 @@ class BudgetRepository implements BudgetRepositoryInterface
/**
* @param Budget $budget
* @param array $data
*
* @throws FireflyException
* @throws JsonException
*/

View File

@@ -57,6 +57,7 @@ interface BudgetRepositoryInterface
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function budgetedInPeriod(Carbon $start, Carbon $end): array;
@@ -67,6 +68,7 @@ interface BudgetRepositoryInterface
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array;
@@ -173,6 +175,7 @@ interface BudgetRepositoryInterface
/**
* @param Budget $budget
*
* @return string|null
*/
public function getNoteText(Budget $budget): ?string;

View File

@@ -288,6 +288,7 @@ class OperationsRepository implements OperationsRepositoryInterface
* @param Collection|null $accounts
* @param Collection|null $budgets
* @param TransactionCurrency|null $currency
*
* @return array
* @deprecated
*/

View File

@@ -473,6 +473,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
* @param TransactionCurrency $toCurrency
* @param Carbon $date
* @param float $rate
*
* @return CurrencyExchangeRate
*/
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate

View File

@@ -226,6 +226,7 @@ interface CurrencyRepositoryInterface
* @param TransactionCurrency $toCurrency
* @param Carbon $date
* @param float $rate
*
* @return CurrencyExchangeRate
*/
public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate;

View File

@@ -172,6 +172,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
/**
* @param TransactionJournal $one
* @param TransactionJournal $two
*
* @return TransactionJournalLink|null
*/
public function getLink(TransactionJournal $one, TransactionJournal $two): ?TransactionJournalLink

View File

@@ -47,6 +47,7 @@ trait ModifiesPiggyBanks
* @param PiggyBankRepetition $repetition
* @param string $amount
* @param TransactionJournal $journal
*
* @return void
*/
public function addAmountToRepetition(PiggyBankRepetition $repetition, string $amount, TransactionJournal $journal): void
@@ -66,6 +67,7 @@ trait ModifiesPiggyBanks
* @param PiggyBank $piggyBank
* @param string $amount
* @param TransactionJournal|null $journal
*
* @return bool
*/
public function removeAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool
@@ -87,6 +89,7 @@ trait ModifiesPiggyBanks
* @param PiggyBank $piggyBank
* @param string $amount
* @param TransactionJournal|null $journal
*
* @return bool
*/
public function addAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool

View File

@@ -41,6 +41,7 @@ interface PiggyBankRepositoryInterface
* @param PiggyBank $piggyBank
* @param string $amount
* @param TransactionJournal|null $journal
*
* @return bool
*/
public function addAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool;
@@ -49,6 +50,7 @@ interface PiggyBankRepositoryInterface
* @param PiggyBankRepetition $repetition
* @param string $amount
* @param TransactionJournal $journal
*
* @return void
*/
public function addAmountToRepetition(PiggyBankRepetition $repetition, string $amount, TransactionJournal $journal): void;
@@ -203,6 +205,7 @@ interface PiggyBankRepositoryInterface
* @param PiggyBank $piggyBank
* @param string $amount
* @param TransactionJournal|null $journal
*
* @return bool
*/
public function removeAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool;

View File

@@ -42,6 +42,7 @@ interface RecurringRepositoryInterface
/**
* @param Recurrence $recurrence
* @param Carbon $date
*
* @return bool
*/
public function createdPreviously(Recurrence $recurrence, Carbon $date): bool;

View File

@@ -104,6 +104,7 @@ interface UserRepositoryInterface
/**
* @param InvitedUser $invite
*
* @return void
*/
public function deleteInvite(InvitedUser $invite): void;
@@ -158,6 +159,7 @@ interface UserRepositoryInterface
/**
* @param User $user
* @param int $groupId
*
* @return array
*/
public function getRolesInGroup(User $user, int $groupId): array;
@@ -182,12 +184,14 @@ interface UserRepositoryInterface
/**
* @param User|Authenticatable|null $user
* @param string $email
*
* @return InvitedUser
*/
public function inviteUser(User | Authenticatable | null $user, string $email): InvitedUser;
/**
* @param string $code
*
* @return void
*/
public function redeemCode(string $code): void;
@@ -245,6 +249,7 @@ interface UserRepositoryInterface
/**
* @param string $code
*
* @return bool
*/
public function validateInviteCode(string $code): bool;

View File

@@ -403,6 +403,7 @@ trait AccountServiceTrait
* @param string $direction
* @param string $openingBalance
* @param Carbon $openingBalanceDate
*
* @return TransactionGroup
* @throws FireflyException
* @throws JsonException

View File

@@ -210,6 +210,7 @@ class CreditRecalculateService
* @param string $direction
* @param Transaction $transaction
* @param string $leftOfDebt
*
* @return string
*/
private function processTransaction(Account $account, string $direction, Transaction $transaction, string $leftOfDebt): string

View File

@@ -244,6 +244,7 @@ trait JournalServiceTrait
/**
* @param array $types
*
* @return null|string
*/
private function getCreatableType(array $types): ?string

View File

@@ -243,6 +243,7 @@ class AccountUpdateService
/**
* @param array $array
*
* @return array
*/
private function getTypeIds(array $array): array

View File

@@ -33,6 +33,7 @@ use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
use FireflyIII\User;
use Illuminate\Support\Facades\Log;
use JsonException;
/**
* Class RecurrenceUpdateService
@@ -212,8 +213,9 @@ class RecurrenceUpdateService
*
* @param Recurrence $recurrence
* @param array $transactions
*
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
private function updateTransactions(Recurrence $recurrence, array $transactions): void
{
@@ -273,6 +275,7 @@ class RecurrenceUpdateService
/**
* @param Recurrence $recurrence
* @param array $combination
*
* @return void
*/
private function updateCombination(Recurrence $recurrence, array $combination): void
@@ -354,6 +357,7 @@ class RecurrenceUpdateService
/**
* @param Recurrence $recurrence
* @param int $transactionId
*
* @return void
*/
private function deleteTransaction(Recurrence $recurrence, int $transactionId): void

View File

@@ -49,6 +49,7 @@ class RemoteUserGuard implements Guard
*
* @param UserProvider $provider
* @param Application $app
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Calculator.php
* Copyright (c) 2023 Antonio Spinelli https://github.com/tonicospinelli
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,10 +21,13 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar;
use Carbon\Carbon;
use FireflyIII\Support\Calendar\Exceptions\IntervalException;
use SplObjectStorage;
/**
* Class Calculator
@@ -32,62 +35,18 @@ use FireflyIII\Support\Calendar\Exceptions\IntervalException;
class Calculator
{
public const DEFAULT_INTERVAL = 1;
private static ?SplObjectStorage $intervalMap = null;
private static array $intervals = [];
private static ?\SplObjectStorage $intervalMap = null;
/**
* @return \SplObjectStorage
*/
private static function loadIntervalMap(): \SplObjectStorage
{
if (self::$intervalMap != null) {
return self::$intervalMap;
}
self::$intervalMap = new \SplObjectStorage();
foreach (Periodicity::cases() as $interval) {
$periodicityClass = __NAMESPACE__ . "\\Periodicity\\{$interval->name}";
self::$intervals[] = $interval->name;
self::$intervalMap->attach($interval, new $periodicityClass());
}
return self::$intervalMap;
}
/**
* @param Periodicity $periodicity
* @return bool
*/
private static function containsInterval(Periodicity $periodicity): bool
{
return self::loadIntervalMap()->contains($periodicity);
}
/**
* @param Periodicity $periodicity
* @return bool
*/
public function isAvailablePeriodicity(Periodicity $periodicity): bool
{
return self::containsInterval($periodicity);
}
/**
* @param int $skip
* @return int
*/
private function skipInterval(int $skip): int
{
return self::DEFAULT_INTERVAL + $skip;
}
/**
* @param Carbon $epoch
* @param Periodicity $periodicity
* @param int $skipInterval
*
* @return Carbon
* @throws IntervalException
*/
public function nextDateByInterval(Carbon $epoch, Periodicity $periodicity, int $skipInterval = 0): Carbon
{
public function nextDateByInterval(Carbon $epoch, Periodicity $periodicity, int $skipInterval = 0): Carbon {
if (!self::isAvailablePeriodicity($periodicity)) {
throw IntervalException::unavailable($periodicity, self::$intervals);
}
@@ -98,4 +57,47 @@ class Calculator
return $periodicity->nextDate($epoch->clone(), $interval);
}
/**
* @param Periodicity $periodicity
*
* @return bool
*/
public function isAvailablePeriodicity(Periodicity $periodicity): bool {
return self::containsInterval($periodicity);
}
/**
* @param Periodicity $periodicity
*
* @return bool
*/
private static function containsInterval(Periodicity $periodicity): bool {
return self::loadIntervalMap()->contains($periodicity);
}
/**
* @return SplObjectStorage
*/
private static function loadIntervalMap(): SplObjectStorage {
if (self::$intervalMap != null) {
return self::$intervalMap;
}
self::$intervalMap = new SplObjectStorage();
foreach (Periodicity::cases() as $interval) {
$periodicityClass = __NAMESPACE__ . "\\Periodicity\\{$interval->name}";
self::$intervals[] = $interval->name;
self::$intervalMap->attach($interval, new $periodicityClass());
}
return self::$intervalMap;
}
/**
* @param int $skip
*
* @return int
*/
private function skipInterval(int $skip): int {
return self::DEFAULT_INTERVAL + $skip;
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* IntervalException.php
* Copyright (c) 2023 Antonio Spinelli https://github.com/tonicospinelli
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,32 +21,36 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Exceptions;
use Exception;
use FireflyIII\Support\Calendar\Periodicity;
use Throwable;
/**
* Class IntervalException
*/
final class IntervalException extends \Exception
final class IntervalException extends Exception
{
protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s';
public readonly Periodicity $periodicity;
public readonly array $availableIntervals;
public readonly Periodicity $periodicity;
protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s';
/**
* @param Periodicity $periodicity
* @param array $intervals
* @param int $code
* @param \Throwable|null $previous
* @param Throwable|null $previous
*
* @return IntervalException
*/
public static function unavailable(
Periodicity $periodicity,
array $intervals,
int $code = 0,
?\Throwable $previous = null
?Throwable $previous = null
): IntervalException {
$message = sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Periodicity.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar;
/**

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Bimonthly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
/**

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Daily.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
use Carbon\Carbon;
@@ -33,10 +35,10 @@ final class Daily extends Interval
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
public function nextDate(Carbon $date, int $interval = 1): Carbon {
return ($date->clone())->addDays($this->skip($interval));
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Fortnightly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
/**

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* HalfYearly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
/**

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Interspacable.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
use Carbon\Carbon;
@@ -33,6 +35,7 @@ interface Interspacable
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon;

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Interval.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
/**
@@ -32,10 +34,10 @@ abstract class Interval implements Interspacable
/**
* @param int $skip
*
* @return int
*/
public function skip(int $skip): int
{
public function skip(int $skip): int {
return static::INTERVAL * $skip;
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Monthly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
use Carbon\Carbon;
@@ -33,10 +35,10 @@ class Monthly extends Interval
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
public function nextDate(Carbon $date, int $interval = 1): Carbon {
return ($date->clone())->addMonthsNoOverflow($this->skip($interval));
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Quarterly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
/**

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Weekly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
use Carbon\Carbon;
@@ -33,10 +35,10 @@ class Weekly extends Interval
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
public function nextDate(Carbon $date, int $interval = 1): Carbon {
return ($date->clone())->addWeeks($this->skip($interval));
}
}

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
/*
* Yearly.php
* Copyright (c) 2023 Antonio Spinelli <https://github.com/tonicospinelli>
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -21,6 +21,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Support\Calendar\Periodicity;
use Carbon\Carbon;
@@ -33,10 +35,10 @@ final class Yearly extends Interval
/**
* @param Carbon $date
* @param int $interval
*
* @return Carbon
*/
public function nextDate(Carbon $date, int $interval = 1): Carbon
{
public function nextDate(Carbon $date, int $interval = 1): Carbon {
return ($date->clone())->addYearsNoOverflow($this->skip($interval));
}
}

View File

@@ -66,6 +66,7 @@ class AccountForm
/**
* @param array $types
* @param AccountRepositoryInterface|null $repository
*
* @return array
*/
private function getAccountsGrouped(array $types, AccountRepositoryInterface $repository = null): array

View File

@@ -39,6 +39,7 @@ trait ConvertsExchangeRates
/**
* @param array $set
*
* @return array
*/
public function cerChartSet(array $set): array
@@ -84,6 +85,7 @@ trait ConvertsExchangeRates
/**
* @param int $currencyId
*
* @return TransactionCurrency
*/
private function getCurrency(int $currencyId): TransactionCurrency
@@ -99,6 +101,7 @@ trait ConvertsExchangeRates
* @param TransactionCurrency $from
* @param TransactionCurrency $to
* @param Carbon $date
*
* @return string
*/
private function getRate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): string
@@ -154,6 +157,7 @@ trait ConvertsExchangeRates
/**
* @param TransactionCurrency $currency
* @param Carbon $date
*
* @return string
*/
private function getEuroRate(TransactionCurrency $currency, Carbon $date): string
@@ -203,6 +207,7 @@ trait ConvertsExchangeRates
* the user.
*
* @param array $entries
*
* @return array
*/
public function cerSum(array $entries): array
@@ -258,6 +263,7 @@ trait ConvertsExchangeRates
* @param TransactionCurrency $from
* @param TransactionCurrency $to
* @param Carbon|null $date
*
* @return string
*/
private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string

View File

@@ -32,6 +32,7 @@ use FireflyIII\Support\Calendar\Periodicity;
use Illuminate\Support\Facades\Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Throwable;
/**
* Class Navigation.
@@ -48,30 +49,6 @@ class Navigation
$this->calculator = ($calculator instanceof Calculator) ?: new Calculator();
}
/**
* @param Carbon $epoch
* @param Periodicity $periodicity
* @param int $skipInterval
* @return Carbon
*/
public function nextDateByInterval(Carbon $epoch, Periodicity $periodicity, int $skipInterval = 0): Carbon
{
try {
return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval);
} catch (IntervalException $exception) {
Log::warning($exception->getMessage(), ['exception' => $exception]);
} catch (\Throwable $exception) {
Log::error($exception->getMessage(), ['exception' => $exception]);
}
Log::debug(
"Any error occurred to calculate the next date.",
['date' => $epoch, 'periodicity' => $periodicity->name, 'skipInterval' => $skipInterval]
);
return $epoch;
}
/**
* @param Carbon $theDate
* @param string $repeatFreq
@@ -122,6 +99,31 @@ class Navigation
return $this->nextDateByInterval($theDate, $functionMap[$repeatFreq], $skip);
}
/**
* @param Carbon $epoch
* @param Periodicity $periodicity
* @param int $skipInterval
*
* @return Carbon
*/
public function nextDateByInterval(Carbon $epoch, Periodicity $periodicity, int $skipInterval = 0): Carbon
{
try {
return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval);
} catch (IntervalException $exception) {
Log::warning($exception->getMessage(), ['exception' => $exception]);
} catch (Throwable $exception) {
Log::error($exception->getMessage(), ['exception' => $exception]);
}
Log::debug(
'Any error occurred to calculate the next date.',
['date' => $epoch, 'periodicity' => $periodicity->name, 'skipInterval' => $skipInterval]
);
return $epoch;
}
/**
* @param Carbon $start
* @param Carbon $end
@@ -385,6 +387,7 @@ class Navigation
* range to a normal range.
*
* @param bool $correct
*
* @return string
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface

Some files were not shown because too many files have changed in this diff Show More