mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Various code cleanup.
This commit is contained in:
@@ -109,6 +109,8 @@ class Amount
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function getCurrencyCode(): string
|
||||
{
|
||||
@@ -145,6 +147,8 @@ class Amount
|
||||
* @param User $user
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function getDefaultCurrencyByUser(User $user): TransactionCurrency
|
||||
{
|
||||
|
||||
@@ -44,8 +44,7 @@ class RemoteUserGuard implements Guard
|
||||
* Create a new authentication guard.
|
||||
*
|
||||
* @param UserProvider $provider
|
||||
*
|
||||
* @return void
|
||||
* @param Application $app
|
||||
*/
|
||||
// @phpstan-ignore-next-line
|
||||
public function __construct(UserProvider $provider, Application $app) // @phpstan-ignore-line
|
||||
|
||||
@@ -74,7 +74,6 @@ class CacheProperties
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function has(): bool
|
||||
{
|
||||
|
||||
@@ -24,8 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Cronjobs;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
|
||||
/**
|
||||
* Class AbstractCronjob
|
||||
|
||||
@@ -190,6 +190,7 @@ trait AugumentData
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getLimits(Budget $budget, Carbon $start, Carbon $end): Collection // get data + augment with info
|
||||
{
|
||||
|
||||
@@ -45,7 +45,8 @@ trait ChartGeneration
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ trait GetConfigurationData
|
||||
* Get config for date range.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
protected function getDateRangeConfig(): array // get configuration + get preferences.
|
||||
{
|
||||
|
||||
@@ -78,6 +78,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
|
||||
{
|
||||
@@ -269,6 +270,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array
|
||||
{
|
||||
@@ -347,6 +349,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array
|
||||
{
|
||||
@@ -400,6 +403,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
|
||||
{
|
||||
@@ -480,6 +484,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
|
||||
{
|
||||
@@ -554,6 +559,7 @@ trait PeriodOverview
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array
|
||||
{
|
||||
|
||||
@@ -162,6 +162,7 @@ trait RequestInformation
|
||||
* Returns if user has seen demo.
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
final protected function hasSeenDemo(): bool // get request info + get preference
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Http\Controllers;
|
||||
|
||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use FireflyIII\Support\Search\OperatorQuerySearch;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -51,6 +51,7 @@ class ParseDateString
|
||||
* @param string $date
|
||||
*
|
||||
* @return Carbon
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function parseDate(string $date): Carbon
|
||||
{
|
||||
@@ -265,31 +266,20 @@ class ParseDateString
|
||||
protected function parseKeyword(string $keyword): Carbon
|
||||
{
|
||||
$today = Carbon::today()->startOfDay();
|
||||
switch ($keyword) {
|
||||
default:
|
||||
case 'today':
|
||||
return $today;
|
||||
case 'yesterday':
|
||||
return $today->subDay();
|
||||
case 'tomorrow':
|
||||
return $today->addDay();
|
||||
case 'start of this week':
|
||||
return $today->startOfWeek();
|
||||
case 'end of this week':
|
||||
return $today->endOfWeek();
|
||||
case 'start of this month':
|
||||
return $today->startOfMonth();
|
||||
case 'end of this month':
|
||||
return $today->endOfMonth();
|
||||
case 'start of this quarter':
|
||||
return $today->startOfQuarter();
|
||||
case 'end of this quarter':
|
||||
return $today->endOfQuarter();
|
||||
case 'start of this year':
|
||||
return $today->startOfYear();
|
||||
case 'end of this year':
|
||||
return $today->endOfYear();
|
||||
}
|
||||
|
||||
return match ($keyword) {
|
||||
default => $today,
|
||||
'yesterday' => $today->subDay(),
|
||||
'tomorrow' => $today->addDay(),
|
||||
'start of this week' => $today->startOfWeek(),
|
||||
'end of this week' => $today->endOfWeek(),
|
||||
'start of this month' => $today->startOfMonth(),
|
||||
'end of this month' => $today->endOfMonth(),
|
||||
'start of this quarter' => $today->startOfQuarter(),
|
||||
'end of this quarter' => $today->endOfQuarter(),
|
||||
'start of this year' => $today->startOfYear(),
|
||||
'end of this year' => $today->endOfYear(),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,7 +361,6 @@ class ParseDateString
|
||||
],
|
||||
];
|
||||
|
||||
/** @var string $part */
|
||||
foreach ($parts as $part) {
|
||||
Log::debug(sprintf('Now parsing part "%s"', $part));
|
||||
$part = trim($part);
|
||||
|
||||
@@ -28,7 +28,6 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use PDOException;
|
||||
use Session;
|
||||
|
||||
@@ -107,6 +106,7 @@ class Preferences
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return Preference|null
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getFresh(string $name, $default = null): ?Preference
|
||||
{
|
||||
@@ -207,6 +207,7 @@ class Preferences
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function lastActivity(): string
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace FireflyIII\Support\Request;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Exception;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
|
||||
@@ -166,7 +166,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function searchTransactions(): LengthAwarePaginator
|
||||
{
|
||||
|
||||
@@ -49,7 +49,6 @@ class Steam
|
||||
* @param TransactionCurrency|null $currency
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
|
||||
@@ -97,6 +96,7 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return string
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balanceIgnoreVirtual(Account $account, Carbon $date): string
|
||||
{
|
||||
@@ -164,6 +164,8 @@ class Steam
|
||||
* @param TransactionCurrency|null $currency
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array
|
||||
{
|
||||
@@ -246,6 +248,7 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balancePerCurrency(Account $account, Carbon $date): array
|
||||
{
|
||||
@@ -279,6 +282,8 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balancesByAccounts(Collection $accounts, Carbon $date): array
|
||||
{
|
||||
@@ -311,6 +316,7 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balancesPerCurrencyByAccounts(Collection $accounts, Carbon $date): array
|
||||
{
|
||||
@@ -444,6 +450,7 @@ class Steam
|
||||
* Get user's language.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getLanguage(): string // get preference
|
||||
{
|
||||
@@ -454,6 +461,7 @@ class Steam
|
||||
* Get user's locale.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getLocale(): string // get preference
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user