mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 01:16:46 -06:00
Various code cleanup.
This commit is contained in:
parent
d60650cff2
commit
ad54163518
@ -39,7 +39,7 @@ class AccountList implements BinderInterface
|
||||
* @param Route $route
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
|
@ -38,7 +38,7 @@ class BudgetList implements BinderInterface
|
||||
* @param Route $route
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
|
@ -39,7 +39,7 @@ class CLIToken implements BinderInterface
|
||||
* @param Route $route
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route)
|
||||
{
|
||||
@ -53,7 +53,7 @@ class CLIToken implements BinderInterface
|
||||
}
|
||||
|
||||
foreach ($users as $user) {
|
||||
$accessToken = app('preferences')->getForUser($user, 'access_token', null);
|
||||
$accessToken = app('preferences')->getForUser($user, 'access_token');
|
||||
if (null !== $accessToken && $accessToken->data === $value) {
|
||||
Log::info(sprintf('Recognized user #%d (%s) from his acccess token.', $user->id, $user->email));
|
||||
|
||||
|
@ -37,7 +37,7 @@ class CategoryList implements BinderInterface
|
||||
* @param Route $route
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): Collection
|
||||
@ -54,7 +54,7 @@ class CategoryList implements BinderInterface
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Support\Collection $collection */
|
||||
/** @var Collection $collection */
|
||||
$collection = auth()->user()->categories()
|
||||
->whereIn('id', $list)
|
||||
->get();
|
||||
|
@ -36,7 +36,7 @@ class CurrencyCode implements BinderInterface
|
||||
* @param Route $route
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): TransactionCurrency
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class DynamicConfigKey
|
||||
* @param Route $route
|
||||
*
|
||||
* @return string
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): string
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ class EitherConfigKey
|
||||
* @param Route $route
|
||||
*
|
||||
* @return string
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): string
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ class JournalList implements BinderInterface
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): array
|
||||
{
|
||||
|
@ -74,6 +74,7 @@ class CacheProperties
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function has(): bool
|
||||
{
|
||||
@ -86,14 +87,13 @@ class CacheProperties
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws JsonException
|
||||
*/
|
||||
private function hash(): void
|
||||
{
|
||||
$content = '';
|
||||
foreach ($this->properties as $property) {
|
||||
try {
|
||||
$content .= json_encode($property, JSON_THROW_ON_ERROR, 512);
|
||||
$content .= json_encode($property, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
// @ignoreException
|
||||
$content .= hash('sha256', (string)time());
|
||||
|
@ -112,7 +112,7 @@ class FrontpageChartGenerator
|
||||
*/
|
||||
private function noBudgetLimits(array $data, Budget $budget): array
|
||||
{
|
||||
$spent = $this->opsRepository->sumExpenses($this->start, $this->end, null, new Collection([$budget]), null);
|
||||
$spent = $this->opsRepository->sumExpenses($this->start, $this->end, null, new Collection([$budget]));
|
||||
/** @var array $entry */
|
||||
foreach ($spent as $entry) {
|
||||
$title = sprintf('%s (%s)', $budget->name, $entry['currency_name']);
|
||||
|
@ -59,7 +59,6 @@ class WholePeriodChartGenerator
|
||||
$spent = [];
|
||||
$earned = [];
|
||||
|
||||
/** @var Carbon $current */
|
||||
$current = clone $start;
|
||||
|
||||
while ($current <= $end) {
|
||||
@ -92,7 +91,6 @@ class WholePeriodChartGenerator
|
||||
];
|
||||
}
|
||||
|
||||
/** @var Carbon $current */
|
||||
$current = clone $start;
|
||||
|
||||
while ($current <= $end) {
|
||||
|
@ -41,12 +41,11 @@ class ExpandedForm
|
||||
use FormSupport;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function amountNoCurrency(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -73,13 +72,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $value
|
||||
* @param mixed $checked
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param int|null $value
|
||||
* @param mixed $checked
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function checkbox(string $name, int $value = null, $checked = null, array $options = null): string
|
||||
{
|
||||
@ -109,12 +107,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function date(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -134,11 +131,10 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function file(string $name, array $options = null): string
|
||||
{
|
||||
@ -157,12 +153,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function integer(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -183,12 +178,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function location(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -234,9 +228,9 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -265,12 +259,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function number(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -339,11 +332,10 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function password(string $name, array $options = null): string
|
||||
{
|
||||
@ -364,12 +356,11 @@ class ExpandedForm
|
||||
/**
|
||||
* Function to render a percentage.
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function percentage(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -390,12 +381,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function staticText(string $name, $value, array $options = null): string
|
||||
{
|
||||
@ -413,12 +403,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function text(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
@ -437,12 +426,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param array|null $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function textarea(string $name, $value = null, array $options = null): string
|
||||
{
|
||||
|
@ -97,8 +97,6 @@ class ExportDataGenerator
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws CannotInsertRecord
|
||||
* @throws Exception
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function export(): array
|
||||
@ -137,6 +135,7 @@ class ExportDataGenerator
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function exportAccounts(): string
|
||||
{
|
||||
@ -172,7 +171,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -226,7 +225,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -290,7 +289,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -339,7 +338,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -403,7 +402,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -501,7 +500,7 @@ class ExportDataGenerator
|
||||
}
|
||||
}
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -568,7 +567,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -618,7 +617,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
@ -738,7 +737,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
$csv = Writer::createFromString('');
|
||||
$csv = Writer::createFromString();
|
||||
|
||||
//insert the header
|
||||
try {
|
||||
|
@ -100,7 +100,7 @@ class FireflyConfig
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Configuration|null
|
||||
* @return Configuration|null
|
||||
*/
|
||||
public function getFresh(string $name, $default = null): ?Configuration
|
||||
{
|
||||
@ -147,7 +147,6 @@ class FireflyConfig
|
||||
return $item;
|
||||
}
|
||||
if (null === $config) {
|
||||
/** @var Configuration $item */
|
||||
$item = new Configuration;
|
||||
$item->name = $name;
|
||||
$item->data = $value;
|
||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Category;
|
||||
@ -76,6 +77,7 @@ trait PeriodOverview
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
|
||||
{
|
||||
@ -266,6 +268,7 @@ trait PeriodOverview
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array
|
||||
{
|
||||
@ -343,6 +346,7 @@ trait PeriodOverview
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array
|
||||
{
|
||||
@ -395,7 +399,7 @@ trait PeriodOverview
|
||||
* @param Carbon $theDate
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
|
||||
{
|
||||
@ -475,7 +479,7 @@ trait PeriodOverview
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
|
||||
{
|
||||
@ -549,7 +553,7 @@ trait PeriodOverview
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ trait UserNavigation
|
||||
$uri = (string)session($identifier);
|
||||
Log::debug(sprintf('The URI is %s', $uri));
|
||||
|
||||
if (false !== strpos($uri, 'jscript')) {
|
||||
if (str_contains($uri, 'jscript')) {
|
||||
$uri = $this->redirectUri;
|
||||
Log::debug(sprintf('URI is now %s (uri contains jscript)', $uri));
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ use Log;
|
||||
class Navigation
|
||||
{
|
||||
/**
|
||||
* @param \Carbon\Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
* @param int $skip
|
||||
* @param Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
* @param int $skip
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*/
|
||||
public function addPeriod(Carbon $theDate, string $repeatFreq, int $skip): Carbon
|
||||
{
|
||||
@ -99,15 +99,14 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param string $range
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param string $range
|
||||
*
|
||||
* @return array
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*
|
||||
*/
|
||||
public function blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range): array
|
||||
public function blockPeriods(Carbon $start, Carbon $end, string $range): array
|
||||
{
|
||||
if ($end < $start) {
|
||||
[$start, $end] = [$end, $start];
|
||||
@ -161,12 +160,12 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param string $repeatFreq
|
||||
* @param Carbon $end
|
||||
* @param string $repeatFreq
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*/
|
||||
public function endOfPeriod(\Carbon\Carbon $end, string $repeatFreq): Carbon
|
||||
public function endOfPeriod(Carbon $end, string $repeatFreq): Carbon
|
||||
{
|
||||
$currentEnd = clone $end;
|
||||
|
||||
@ -239,11 +238,11 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $theCurrentEnd
|
||||
* @param string $repeatFreq
|
||||
* @param \Carbon\Carbon|null $maxDate
|
||||
* @param Carbon $theCurrentEnd
|
||||
* @param string $repeatFreq
|
||||
* @param Carbon|null $maxDate
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*/
|
||||
public function endOfX(Carbon $theCurrentEnd, string $repeatFreq, ?Carbon $maxDate): Carbon
|
||||
{
|
||||
@ -279,8 +278,8 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -315,12 +314,12 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $theDate
|
||||
* @param string $repeatFrequency
|
||||
* @param Carbon $theDate
|
||||
* @param string $repeatFrequency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function periodShow(\Carbon\Carbon $theDate, string $repeatFrequency): string
|
||||
public function periodShow(Carbon $theDate, string $repeatFrequency): string
|
||||
{
|
||||
$date = clone $theDate;
|
||||
$formatMap = [
|
||||
@ -359,8 +358,8 @@ class Navigation
|
||||
* If the date difference between start and end is less than a month, method returns "Y-m-d". If the difference is less than a year,
|
||||
* method returns "Y-m". If the date difference is larger, method returns "Y".
|
||||
*
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -382,8 +381,8 @@ class Navigation
|
||||
* 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".
|
||||
*
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -406,8 +405,8 @@ class Navigation
|
||||
* If the date difference between start and end is less than a month, method returns "endOfDay". If the difference is less than a year,
|
||||
* method returns "endOfMonth". If the date difference is larger, method returns "endOfYear".
|
||||
*
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -429,8 +428,8 @@ class Navigation
|
||||
* If the date difference between start and end is less than a month, method returns "1D". If the difference is less than a year,
|
||||
* method returns "1M". If the date difference is larger, method returns "1Y".
|
||||
*
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -452,8 +451,8 @@ class Navigation
|
||||
* If the date difference between start and end is less than a month, method returns "%Y-%m-%d". If the difference is less than a year,
|
||||
* method returns "%Y-%m". If the date difference is larger, method returns "%Y".
|
||||
*
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -472,10 +471,10 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
* @param Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*/
|
||||
public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon
|
||||
{
|
||||
@ -523,13 +522,13 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
* @param int $subtract
|
||||
* @param Carbon $theDate
|
||||
* @param string $repeatFreq
|
||||
* @param int|null $subtract
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = null): Carbon
|
||||
{
|
||||
@ -586,12 +585,12 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $range
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param string $range
|
||||
* @param Carbon $start
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function updateEndDate(string $range, Carbon $start): Carbon
|
||||
{
|
||||
@ -632,12 +631,12 @@ class Navigation
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $range
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param string $range
|
||||
* @param Carbon $start
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function updateStartDate(string $range, Carbon $start): Carbon
|
||||
{
|
||||
|
@ -84,7 +84,8 @@ class Preferences
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
* @return Preference|null
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function get(string $name, $default = null): ?Preference
|
||||
{
|
||||
@ -104,7 +105,7 @@ class Preferences
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
* @return Preference|null
|
||||
*/
|
||||
public function getFresh(string $name, $default = null): ?Preference
|
||||
{
|
||||
@ -121,8 +122,8 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\User $user
|
||||
* @param array $list
|
||||
* @param User $user
|
||||
* @param array $list
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -148,7 +149,7 @@ class Preferences
|
||||
* @param string $name
|
||||
* @param null|string|int $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
* @return Preference|null
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getForUser(User $user, string $name, $default = null): ?Preference
|
||||
@ -177,12 +178,13 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param string $name
|
||||
* @param null|string $default
|
||||
* @param User $user
|
||||
* @param string $name
|
||||
* @param null $default
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference|null
|
||||
* @return Preference|null
|
||||
* TODO remove me
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getFreshForUser(User $user, string $name, $default = null): ?Preference
|
||||
{
|
||||
@ -220,7 +222,8 @@ class Preferences
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return \FireflyIII\Models\Preference
|
||||
* @return Preference
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function set(string $name, $value): Preference
|
||||
{
|
||||
@ -249,9 +252,9 @@ class Preferences
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\User $user
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param User $user
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return Preference
|
||||
* @throws FireflyException
|
||||
|
@ -51,7 +51,6 @@ class BudgetReportGenerator
|
||||
private array $report;
|
||||
private BudgetRepositoryInterface $repository;
|
||||
private Carbon $start;
|
||||
private User $user;
|
||||
|
||||
/**
|
||||
* BudgetReportGenerator constructor.
|
||||
@ -367,11 +366,10 @@ class BudgetReportGenerator
|
||||
*/
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->repository->setUser($user);
|
||||
$this->blRepository->setUser($user);
|
||||
$this->opsRepository->setUser($user);
|
||||
$this->nbRepository->setUser($user);
|
||||
$this->currency = app('amount')->getDefaultCurrencyByUser($this->user);
|
||||
$this->currency = app('amount')->getDefaultCurrencyByUser($user);
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,13 @@ class Steam
|
||||
/**
|
||||
* Gets balance at the end of current month by default
|
||||
*
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param Account $account
|
||||
* @param Carbon $date
|
||||
* @param TransactionCurrency|null $currency
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
|
||||
{
|
||||
@ -88,8 +91,8 @@ class Steam
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param Account $account
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -153,10 +156,10 @@ class Steam
|
||||
*
|
||||
* [yyyy-mm-dd] => 123,2
|
||||
*
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
* @param \Carbon\Carbon $start
|
||||
* @param \Carbon\Carbon $end
|
||||
* @param TransactionCurrency|null $currency
|
||||
* @param Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param TransactionCurrency|null $currency
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -237,8 +240,8 @@ class Steam
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \FireflyIII\Models\Account $account
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param Account $account
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -270,8 +273,8 @@ class Steam
|
||||
/**
|
||||
* This method always ignores the virtual balance.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $accounts
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -302,8 +305,8 @@ class Steam
|
||||
/**
|
||||
* Same as above, but also groups per currency.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $accounts
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -372,7 +375,7 @@ class Steam
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
* @param string|null $amount
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ class Telemetry
|
||||
private function hasEntry(string $type, string $key, string $value): bool
|
||||
{
|
||||
try {
|
||||
$jsonEncoded = json_encode($value, JSON_THROW_ON_ERROR, 512);
|
||||
$jsonEncoded = json_encode($value, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
Log::error(sprintf('JSON Exception encoding the following value: %s: %s', $value, $e->getMessage()));
|
||||
$jsonEncoded = [];
|
||||
@ -153,7 +153,7 @@ class Telemetry
|
||||
private function hasRecentEntry(string $type, string $key, string $value, Carbon $date): bool
|
||||
{
|
||||
try {
|
||||
$jsonEncoded = json_encode($value, JSON_THROW_ON_ERROR, 512);
|
||||
$jsonEncoded = json_encode($value, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
Log::error(sprintf('JSON Exception encoding the following value: %s: %s', $value, $e->getMessage()));
|
||||
$jsonEncoded = [];
|
||||
@ -173,11 +173,13 @@ class Telemetry
|
||||
* @param string $type
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
private function storeEntry(string $type, string $name, string $value): void
|
||||
{
|
||||
$this->generateInstallationId();
|
||||
$config = app('fireflyconfig')->get('installation_id', null);
|
||||
$config = app('fireflyconfig')->get('installation_id');
|
||||
$installationId = null !== $config ? $config->data : 'empty';
|
||||
try {
|
||||
TelemetryModel::create(
|
||||
|
Loading…
Reference in New Issue
Block a user