mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Merge pull request #7068 from firefly-iii/cleanup-comments
Cleanup comments
This commit is contained in:
@@ -49,7 +49,7 @@ class Amount
|
||||
* @param bool $coloured
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = null): string
|
||||
{
|
||||
@@ -204,6 +204,7 @@ class Amount
|
||||
* Used only in one place.
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getJsConfig(): array
|
||||
{
|
||||
|
@@ -32,6 +32,8 @@ use Illuminate\Contracts\Auth\UserProvider;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class RemoteUserGuard
|
||||
@@ -47,6 +49,8 @@ class RemoteUserGuard implements Guard
|
||||
*
|
||||
* @param UserProvider $provider
|
||||
* @param Application $app
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function __construct(UserProvider $provider, Application $app)
|
||||
{
|
||||
@@ -58,15 +62,6 @@ class RemoteUserGuard implements Guard
|
||||
$this->user = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function viaRemember(): bool
|
||||
{
|
||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -185,4 +180,13 @@ class RemoteUserGuard implements Guard
|
||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||
throw new FireflyException('Did not implement RemoteUserGuard::validate()');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function viaRemember(): bool
|
||||
{
|
||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Chart\Budget;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
@@ -221,7 +220,6 @@ class FrontpageChartGenerator
|
||||
* A basic setter for the user. Also updates the repositories with the right user.
|
||||
*
|
||||
* @param User $user
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
|
@@ -48,6 +48,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function amountNoCurrency(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -81,6 +82,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function checkbox(string $name, int $value = null, $checked = null, array $options = null): string
|
||||
{
|
||||
@@ -116,6 +118,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function date(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -140,6 +143,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function file(string $name, array $options = null): string
|
||||
{
|
||||
@@ -164,6 +168,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function integer(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -190,6 +195,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function location(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -243,6 +249,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function nonSelectableAmount(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -275,6 +282,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function number(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -300,6 +308,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function objectGroup($value = null, array $options = null): string
|
||||
{
|
||||
@@ -330,7 +339,7 @@ class ExpandedForm
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function optionsList(string $type, string $name): string
|
||||
{
|
||||
@@ -350,6 +359,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function password(string $name, array $options = null): string
|
||||
{
|
||||
@@ -375,6 +385,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function percentage(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -401,6 +412,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function staticText(string $name, $value, array $options = null): string
|
||||
{
|
||||
@@ -424,6 +436,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function text(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -448,6 +461,7 @@ class ExpandedForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function textarea(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
|
@@ -102,7 +102,9 @@ class ExportDataGenerator
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws FireflyException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function export(): array
|
||||
{
|
||||
@@ -826,6 +828,14 @@ class ExportDataGenerator
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
@@ -995,6 +1005,14 @@ class ExportDataGenerator
|
||||
return implode(',', $smol);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function has(mixed $key): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $end
|
||||
*/
|
||||
@@ -1082,20 +1100,4 @@ class ExportDataGenerator
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function has(mixed $key): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class AccountForm.
|
||||
*
|
||||
*/
|
||||
|
@@ -29,7 +29,6 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class Amount.
|
||||
*
|
||||
* @method string formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true)
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class CurrencyForm.
|
||||
*
|
||||
*/
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class ExpandedForm.
|
||||
*/
|
||||
class ExpandedForm extends Facade
|
||||
|
@@ -27,7 +27,6 @@ use FireflyIII\Models\Configuration;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class FireflyConfig.
|
||||
* @method null|Configuration get($name, $default = null)
|
||||
* @method Configuration set(string $name, $value)
|
||||
|
@@ -27,7 +27,6 @@ use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class Navigation.
|
||||
*
|
||||
* @method Carbon addPeriod(Carbon $theDate, string $repeatFreq, int $skip)
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class PiggyBankForm.
|
||||
*
|
||||
*/
|
||||
|
@@ -29,7 +29,6 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class Preferences.
|
||||
*
|
||||
* @method Collection beginsWith(User $user, string $search)
|
||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
|
||||
* Class RuleForm.
|
||||
*
|
||||
*/
|
||||
|
@@ -122,6 +122,7 @@ class AccountForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function assetAccountCheckList(string $name, array $options = null): string
|
||||
{
|
||||
|
@@ -46,6 +46,7 @@ class CurrencyForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function amount(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -59,6 +60,7 @@ class CurrencyForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function currencyField(string $name, string $view, mixed $value = null, array $options = null): string
|
||||
{
|
||||
@@ -114,6 +116,7 @@ class CurrencyForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function balanceAll(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@@ -129,6 +132,7 @@ class CurrencyForm
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function allCurrencyField(string $name, string $view, $value = null, array $options = null): string
|
||||
{
|
||||
|
@@ -74,60 +74,6 @@ trait ConvertsExchangeRates
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a sum of entries, get the exchange rate to the native currency of
|
||||
* the user.
|
||||
* @param array $entries
|
||||
* @return array
|
||||
*/
|
||||
public function cerSum(array $entries): array
|
||||
{
|
||||
if (null === $this->enabled) {
|
||||
$this->getPreference();
|
||||
}
|
||||
|
||||
// if false, return the same array without conversion info
|
||||
if (false === $this->enabled) {
|
||||
$return = [];
|
||||
/** @var array $entry */
|
||||
foreach ($entries as $entry) {
|
||||
$entry['converted'] = false;
|
||||
$return[] = $entry;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/** @var TransactionCurrency $native */
|
||||
$native = app('amount')->getDefaultCurrency();
|
||||
$return = [];
|
||||
/** @var array $entry */
|
||||
foreach ($entries as $entry) {
|
||||
$currency = $this->getCurrency((int)$entry['id']);
|
||||
if ($currency->id !== $native->id) {
|
||||
$amount = $this->convertAmount($entry['sum'], $currency, $native);
|
||||
$entry['converted'] = true;
|
||||
$entry['native_sum'] = $amount;
|
||||
$entry['native_id'] = (string)$native->id;
|
||||
$entry['native_name'] = $native->name;
|
||||
$entry['native_symbol'] = $native->symbol;
|
||||
$entry['native_code'] = $native->code;
|
||||
$entry['native_decimal_places'] = $native->decimal_places;
|
||||
}
|
||||
if ($currency->id === $native->id) {
|
||||
$entry['converted'] = false;
|
||||
$entry['native_sum'] = $entry['sum'];
|
||||
$entry['native_id'] = (string)$native->id;
|
||||
$entry['native_name'] = $native->name;
|
||||
$entry['native_symbol'] = $native->symbol;
|
||||
$entry['native_code'] = $native->code;
|
||||
$entry['native_decimal_places'] = $native->decimal_places;
|
||||
}
|
||||
$return[] = $entry;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
@@ -149,21 +95,6 @@ trait ConvertsExchangeRates
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
* @return string
|
||||
*/
|
||||
private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string
|
||||
{
|
||||
Log::debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code));
|
||||
$date = $date ?? today(config('app.timezone'));
|
||||
$rate = $this->getRate($from, $to, $date);
|
||||
|
||||
return bcmul($amount, $rate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
@@ -266,4 +197,67 @@ trait ConvertsExchangeRates
|
||||
Log::debug(sprintf('No rate for %s to EUR.', $currency->code));
|
||||
return '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* For a sum of entries, get the exchange rate to the native currency of
|
||||
* the user.
|
||||
* @param array $entries
|
||||
* @return array
|
||||
*/
|
||||
public function cerSum(array $entries): array
|
||||
{
|
||||
if (null === $this->enabled) {
|
||||
$this->getPreference();
|
||||
}
|
||||
|
||||
// if false, return the same array without conversion info
|
||||
if (false === $this->enabled) {
|
||||
$return = [];
|
||||
/** @var array $entry */
|
||||
foreach ($entries as $entry) {
|
||||
$entry['converted'] = false;
|
||||
$return[] = $entry;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/** @var TransactionCurrency $native */
|
||||
$native = app('amount')->getDefaultCurrency();
|
||||
$return = [];
|
||||
/** @var array $entry */
|
||||
foreach ($entries as $entry) {
|
||||
$currency = $this->getCurrency((int)$entry['id']);
|
||||
if ($currency->id !== $native->id) {
|
||||
$amount = $this->convertAmount($entry['sum'], $currency, $native);
|
||||
$entry['converted'] = true;
|
||||
$entry['native_sum'] = $amount;
|
||||
$entry['native_id'] = (string)$native->id;
|
||||
$entry['native_name'] = $native->name;
|
||||
$entry['native_symbol'] = $native->symbol;
|
||||
$entry['native_code'] = $native->code;
|
||||
$entry['native_decimal_places'] = $native->decimal_places;
|
||||
}
|
||||
if ($currency->id === $native->id) {
|
||||
$entry['converted'] = false;
|
||||
$entry['native_sum'] = $entry['sum'];
|
||||
$entry['native_id'] = (string)$native->id;
|
||||
$entry['native_name'] = $native->name;
|
||||
$entry['native_symbol'] = $native->symbol;
|
||||
$entry['native_code'] = $native->code;
|
||||
$entry['native_decimal_places'] = $native->decimal_places;
|
||||
}
|
||||
$return[] = $entry;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string
|
||||
{
|
||||
Log::debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code));
|
||||
$date = $date ?? today(config('app.timezone'));
|
||||
$rate = $this->getRate($from, $to, $date);
|
||||
|
||||
return bcmul($amount, $rate);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Support\Cronjobs\AutoBudgetCronjob;
|
||||
use FireflyIII\Support\Cronjobs\RecurringCronjob;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Trait CronRunner
|
||||
@@ -69,6 +71,8 @@ trait CronRunner
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function runRecurring(bool $force, Carbon $date): array
|
||||
{
|
||||
|
@@ -45,6 +45,7 @@ trait ModelInformation
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getActionsForBill(Bill $bill): array // get info and augument
|
||||
{
|
||||
@@ -69,7 +70,6 @@ trait ModelInformation
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
*
|
||||
* @return string[]
|
||||
*
|
||||
@@ -94,7 +94,6 @@ trait ModelInformation
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* @return array
|
||||
*/
|
||||
protected function getRoles(): array
|
||||
@@ -113,6 +112,7 @@ trait ModelInformation
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getTriggersForBill(Bill $bill): array // get info and augument
|
||||
{
|
||||
@@ -164,6 +164,7 @@ trait ModelInformation
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getTriggersForJournal(TransactionJournal $journal): array
|
||||
{
|
||||
|
@@ -200,7 +200,6 @@ trait PeriodOverview
|
||||
* @param array $journals
|
||||
*
|
||||
* @return array
|
||||
|
||||
*/
|
||||
private function filterTransferredIn(Account $account, array $journals): array
|
||||
{
|
||||
@@ -219,7 +218,6 @@ trait PeriodOverview
|
||||
* @param array $journals
|
||||
*
|
||||
* @return array
|
||||
|
||||
*/
|
||||
private function groupByCurrency(array $journals): array
|
||||
{
|
||||
|
@@ -51,6 +51,7 @@ trait RenderPartialViews
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function budgetEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
@@ -81,6 +82,7 @@ trait RenderPartialViews
|
||||
* Get options for budget report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function budgetReportOptions(): string // render a view
|
||||
{
|
||||
@@ -105,6 +107,7 @@ trait RenderPartialViews
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function budgetSpentAmount(array $attributes): string // generate view for report.
|
||||
{
|
||||
@@ -137,6 +140,7 @@ trait RenderPartialViews
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function categoryEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
@@ -163,6 +167,7 @@ trait RenderPartialViews
|
||||
* Get options for category report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function categoryReportOptions(): string // render a view
|
||||
{
|
||||
@@ -185,6 +190,7 @@ trait RenderPartialViews
|
||||
* Get options for double report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function doubleReportOptions(): string // render a view
|
||||
{
|
||||
@@ -229,6 +235,7 @@ trait RenderPartialViews
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function expenseEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
@@ -263,6 +270,7 @@ trait RenderPartialViews
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getCurrentActions(Rule $rule): array // get info from object and present.
|
||||
{
|
||||
@@ -301,7 +309,7 @@ trait RenderPartialViews
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getCurrentTriggers(Rule $rule): array // get info from object and present.
|
||||
{
|
||||
@@ -357,6 +365,7 @@ trait RenderPartialViews
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function incomeEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
@@ -388,6 +397,7 @@ trait RenderPartialViews
|
||||
* Get options for default report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function noReportOptions(): string // render a view
|
||||
{
|
||||
@@ -406,6 +416,7 @@ trait RenderPartialViews
|
||||
* Get options for tag report.
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function tagReportOptions(): string // render a view
|
||||
{
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Exceptions\ValidationException;
|
||||
use FireflyIII\Helpers\Help\HelpInterface;
|
||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||
@@ -89,7 +88,6 @@ trait RequestInformation
|
||||
* Returns if user has seen demo.
|
||||
*
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
@@ -220,7 +218,6 @@ trait RequestInformation
|
||||
* @param array $data
|
||||
*
|
||||
* @return ValidatorContract
|
||||
|
||||
*/
|
||||
final protected function validator(array $data): ValidatorContract
|
||||
{
|
||||
|
@@ -40,7 +40,7 @@ trait RuleManagement
|
||||
* @param Request $request
|
||||
*
|
||||
* @return array
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getPreviousActions(Request $request): array
|
||||
{
|
||||
@@ -75,7 +75,7 @@ trait RuleManagement
|
||||
* @param Request $request
|
||||
*
|
||||
* @return array
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getPreviousTriggers(Request $request): array
|
||||
{
|
||||
@@ -122,6 +122,7 @@ trait RuleManagement
|
||||
* @param array $submittedOperators
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function parseFromOperators(array $submittedOperators): array
|
||||
{
|
||||
|
@@ -27,6 +27,8 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class Navigation.
|
||||
@@ -328,6 +330,37 @@ class Navigation
|
||||
return $currentEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's view range and if necessary, corrects the dynamic view
|
||||
* range to a normal range.
|
||||
* @param bool $correct
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getViewRange(bool $correct): string
|
||||
{
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||
if (!$correct) {
|
||||
return $range;
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
return $range;
|
||||
case 'last7':
|
||||
return '1W';
|
||||
case 'last30':
|
||||
case 'MTD':
|
||||
return '1M';
|
||||
case 'last90':
|
||||
case 'QTD':
|
||||
return '3M';
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
return '1Y';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
@@ -428,35 +461,6 @@ class Navigation
|
||||
return $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's view range and if necessary, corrects the dynamic view
|
||||
* range to a normal range.
|
||||
* @param bool $correct
|
||||
* @return string
|
||||
*/
|
||||
public function getViewRange(bool $correct): string
|
||||
{
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||
if (!$correct) {
|
||||
return $range;
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
return $range;
|
||||
case 'last7':
|
||||
return '1W';
|
||||
case 'last30':
|
||||
case 'MTD':
|
||||
return '1M';
|
||||
case 'last90':
|
||||
case 'QTD':
|
||||
return '3M';
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
return '1Y';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the date difference between start and end is less than a month, method returns trans(config.month_and_day). If the difference is less than a year,
|
||||
* method returns "config.month". If the date difference is larger, method returns "config.year".
|
||||
@@ -465,7 +469,6 @@ class Navigation
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
|
@@ -88,7 +88,7 @@ class ParseDateString
|
||||
}
|
||||
|
||||
// if regex for YYYY-MM-DD:
|
||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
||||
if (preg_match($pattern, $date)) {
|
||||
return $this->parseDefaultDate($date);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class ParseDateString
|
||||
throw new FireflyException(sprintf('[a] Not a recognised date format: "%s"', $date));
|
||||
}
|
||||
// can't do a partial year:
|
||||
$substrCount = substr_count(substr($date, 0, 4), 'x', 0);
|
||||
$substrCount = substr_count(substr($date, 0, 4), 'x');
|
||||
if (10 === strlen($date) && $substrCount > 0 && $substrCount < 4) {
|
||||
throw new FireflyException(sprintf('[b] Not a recognised date format: "%s"', $date));
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class ParseDateString
|
||||
protected function isDayRange(string $date): bool
|
||||
{
|
||||
// if regex for xxxx-xx-DD:
|
||||
$pattern = '/^xxxx-xx-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||
if (preg_match($pattern, $date)) {
|
||||
Log::debug(sprintf('"%s" is a day range.', $date));
|
||||
|
||||
@@ -361,7 +361,7 @@ class ParseDateString
|
||||
protected function isMonthDayRange(string $date): bool
|
||||
{
|
||||
// if regex for xxxx-MM-DD:
|
||||
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
||||
if (preg_match($pattern, $date)) {
|
||||
Log::debug(sprintf('"%s" is a month/day range.', $date));
|
||||
|
||||
@@ -398,7 +398,7 @@ class ParseDateString
|
||||
protected function isDayYearRange(string $date): bool
|
||||
{
|
||||
// if regex for YYYY-xx-DD:
|
||||
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||
if (preg_match($pattern, $date)) {
|
||||
Log::debug(sprintf('"%s" is a day/year range.', $date));
|
||||
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use Cache;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\User;
|
||||
|
@@ -32,25 +32,6 @@ use Log;
|
||||
*/
|
||||
trait ConvertsDataTypes
|
||||
{
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed|null $default
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function get(string $key, mixed $default = null): mixed;
|
||||
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function has($key);
|
||||
|
||||
/**
|
||||
* Return integer value.
|
||||
*
|
||||
@@ -63,6 +44,16 @@ trait ConvertsDataTypes
|
||||
return (int)$this->get($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed|null $default
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function get(string $key, mixed $default = null): mixed;
|
||||
|
||||
/**
|
||||
* Return string value.
|
||||
*
|
||||
@@ -285,6 +276,15 @@ trait ConvertsDataTypes
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method that always exists in the Request classes that use this
|
||||
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function has($key);
|
||||
|
||||
/**
|
||||
* Return date or NULL.
|
||||
*
|
||||
|
@@ -63,6 +63,7 @@ use TypeError;
|
||||
*/
|
||||
class OperatorQuerySearch implements SearchInterface
|
||||
{
|
||||
protected Carbon $date;
|
||||
private AccountRepositoryInterface $accountRepository;
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private BudgetRepositoryInterface $budgetRepository;
|
||||
@@ -73,9 +74,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
private int $limit;
|
||||
private Collection $operators;
|
||||
private int $page;
|
||||
protected Carbon $date;
|
||||
|
||||
|
||||
private array $prohibitedWords;
|
||||
private float $startTime;
|
||||
private TagRepositoryInterface $tagRepository;
|
||||
@@ -241,10 +239,7 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $operator
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updateCollector(string $operator, string $value, bool $prohibited): bool
|
||||
@@ -1568,7 +1563,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $range
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -1627,7 +1621,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $range
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -1666,7 +1659,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $range
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -1705,9 +1697,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
* @return void
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function setExactMetaDateParams(string $field, array $range, bool $prohibited = false): void
|
||||
@@ -1767,9 +1756,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
* @return void
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function setMetaDateBeforeParams(string $field, array $range, bool $prohibited = false): void
|
||||
@@ -1807,9 +1793,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
* @return void
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function setMetaDateAfterParams(string $field, array $range, bool $prohibited = false): void
|
||||
@@ -1847,9 +1830,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
* @return void
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function setExactObjectDateParams(string $field, array $range, bool $prohibited = false): void
|
||||
@@ -1908,8 +1888,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -1948,8 +1926,6 @@ class OperatorQuerySearch implements SearchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param array $range
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -2015,6 +1991,14 @@ class OperatorQuerySearch implements SearchInterface
|
||||
return $this->words;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $date
|
||||
*/
|
||||
public function setDate(Carbon $date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -2049,12 +2033,4 @@ class OperatorQuerySearch implements SearchInterface
|
||||
$this->limit = $limit;
|
||||
$this->collector->setLimit($this->limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $date
|
||||
*/
|
||||
public function setDate(Carbon $date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
}
|
||||
|
@@ -245,6 +245,7 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function balancesByAccounts(Collection $accounts, Carbon $date): array
|
||||
{
|
||||
@@ -277,7 +278,6 @@ class Steam
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function balancesPerCurrencyByAccounts(Collection $accounts, Carbon $date): array
|
||||
{
|
||||
@@ -428,6 +428,21 @@ class Steam
|
||||
return str_replace($search, '', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ipAddress
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getHostName(string $ipAddress): string
|
||||
{
|
||||
try {
|
||||
$hostName = gethostbyaddr($ipAddress);
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
return $hostName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $accounts
|
||||
*
|
||||
@@ -668,19 +683,4 @@ class Steam
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ipAddress
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getHostName(string $ipAddress): string
|
||||
{
|
||||
try {
|
||||
$hostName = gethostbyaddr($ipAddress);
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
return $hostName;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user