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