Code cleanup

This commit is contained in:
James Cole
2018-04-28 06:23:13 +02:00
parent 6f0e1c79ac
commit 13b78bdc20
218 changed files with 621 additions and 681 deletions

View File

@@ -122,6 +122,7 @@ class ReconcileController extends Controller
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
* @throws \Throwable
*/
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
{
@@ -339,6 +340,7 @@ class ReconcileController extends Controller
* @return mixed
*
* @throws FireflyException
* @throws \Throwable
*/
public function transactions(Account $account, Carbon $start, Carbon $end)
{

View File

@@ -380,7 +380,7 @@ class AccountController extends Controller
// update preferences if necessary:
$frontPage = Preferences::get('frontPageAccounts', [])->data;
if (count($frontPage) > 0 && AccountType::ASSET === $account->accountType->type) {
if (AccountType::ASSET === $account->accountType->type && \count($frontPage) > 0) {
// @codeCoverageIgnoreStart
$frontPage[] = $account->id;
Preferences::set('frontPageAccounts', $frontPage);

View File

@@ -62,7 +62,6 @@ class UpdateController extends Controller
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Illuminate\Container\EntryNotFoundException
*/
public function index()
{

View File

@@ -174,7 +174,7 @@ class UserController extends Controller
$data = $request->getUserData();
// update password
if (strlen($data['password']) > 0) {
if (\strlen($data['password']) > 0) {
$repository->changePassword($user, $data['password']);
}

View File

@@ -117,7 +117,7 @@ class AttachmentController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', strlen($content));
->header('Content-Length', \strlen($content));
return $response;
}

View File

@@ -59,7 +59,7 @@ class TwoFactorController extends Controller
return redirect(route('index'));
}
if (0 === strlen((string)$secret)) {
if (0 === \strlen((string)$secret)) {
throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');
}
$request->session()->flash('two-factor-secret', $secret);

View File

@@ -75,7 +75,9 @@ class BillController extends Controller
}
/**
* @param Request $request
* @param Request $request
*
* @param CurrencyRepositoryInterface $repository
*
* @return View
*/
@@ -131,8 +133,9 @@ class BillController extends Controller
}
/**
* @param Request $request
* @param Bill $bill
* @param Request $request
* @param CurrencyRepositoryInterface $repository
* @param Bill $bill
*
* @return View
*/
@@ -293,9 +296,10 @@ class BillController extends Controller
}
/**
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
*
* @param RuleGroupRepositoryInterface $ruleGroupRepository
* @return \Illuminate\Http\RedirectResponse
*/
public function store(BillFormRequest $request, BillRepositoryInterface $repository, RuleGroupRepositoryInterface $ruleGroupRepository)
@@ -315,7 +319,7 @@ class BillController extends Controller
$this->attachments->saveAttachmentsForModel($bill, $files);
// flash messages
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
if (\count($this->attachments->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
}
@@ -364,7 +368,7 @@ class BillController extends Controller
$this->attachments->saveAttachmentsForModel($bill, $files);
// flash messages
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
if (\count($this->attachments->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
}

View File

@@ -417,13 +417,13 @@ class BudgetController extends Controller
// prep for "all" view.
if ('all' === $moment) {
$subTitle = trans('firefly.all_journals_without_budget');
$first = $repository->first();
$start = $first->date ?? new Carbon;
$first = $repository->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = new Carbon;
}
// prep for "specific date" view.
if (strlen($moment) > 0 && 'all' !== $moment) {
if ('all' !== $moment && \strlen($moment) > 0) {
$start = new Carbon($moment);
$end = app('navigation')->endOfPeriod($start, $range);
$subTitle = trans(
@@ -434,7 +434,7 @@ class BudgetController extends Controller
}
// prep for current period
if (0 === strlen($moment)) {
if ('' === $moment) {
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
$periods = $this->getPeriodOverview();

View File

@@ -185,13 +185,13 @@ class CategoryController extends Controller
// prep for "all" view.
if ('all' === $moment) {
$subTitle = trans('firefly.all_journals_without_category');
$first = $this->journalRepos->first();
$start = $first->date ?? new Carbon;
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = new Carbon;
}
// prep for "specific date" view.
if (strlen($moment) > 0 && 'all' !== $moment) {
if ('all' !== $moment && \strlen($moment) > 0) {
$start = app('navigation')->startOfPeriod(new Carbon($moment), $range);
$end = app('navigation')->endOfPeriod($start, $range);
$subTitle = trans(
@@ -202,7 +202,7 @@ class CategoryController extends Controller
}
// prep for current period
if (0 === strlen($moment)) {
if ('' === $moment) {
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
$periods = $this->getNoCategoryPeriodOverview($start);
@@ -255,7 +255,7 @@ class CategoryController extends Controller
}
// prep for "specific date" view.
if (strlen($moment) > 0 && 'all' !== $moment) {
if (\strlen($moment) > 0 && 'all' !== $moment) {
$start = app('navigation')->startOfPeriod(new Carbon($moment), $range);
$end = app('navigation')->endOfPeriod($start, $range);
$subTitle = trans(
@@ -268,7 +268,7 @@ class CategoryController extends Controller
}
// prep for current period
if (0 === strlen($moment)) {
if (0 === \strlen($moment)) {
/** @var Carbon $start */
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
/** @var Carbon $end */
@@ -351,8 +351,8 @@ class CategoryController extends Controller
private function getNoCategoryPeriodOverview(Carbon $theDate): Collection
{
$range = Preferences::get('viewRange', '1M')->data;
$first = $this->journalRepos->first();
$start = $first->date ?? new Carbon;
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = $theDate ?? new Carbon;
// properties for cache
@@ -431,8 +431,8 @@ class CategoryController extends Controller
private function getPeriodOverview(Category $category, Carbon $date): Collection
{
$range = Preferences::get('viewRange', '1M')->data;
$first = $this->journalRepos->first();
$start = $first->date ?? new Carbon;
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = $date ?? new Carbon;
$accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);

View File

@@ -228,7 +228,7 @@ class AccountController extends Controller
Log::debug('Default set is ', $defaultSet);
$frontPage = Preferences::get('frontPageAccounts', $defaultSet);
Log::debug('Frontpage preference set is ', $frontPage->data);
if (0 === count($frontPage->data)) {
if (0 === \count($frontPage->data)) {
$frontPage->data = $defaultSet;
Log::debug('frontpage set is empty!');
$frontPage->save();

View File

@@ -180,7 +180,7 @@ class BudgetReportController extends Controller
$chartData[$budget->id]['entries'][$label] = bcmul($currentExpenses, '-1');
$chartData[$budget->id . '-sum']['entries'][$label] = bcmul($sumOfExpenses[$budget->id], '-1');
if (count($budgetLimits) > 0) {
if (\count($budgetLimits) > 0) {
$budgetLimitId = $budgetLimits->first()->id;
$leftOfLimits[$budgetLimitId] = $leftOfLimits[$budgetLimitId] ?? (string)$budgetLimits->sum('amount');
$leftOfLimits[$budgetLimitId] = bcadd($leftOfLimits[$budgetLimitId], $currentExpenses);

View File

@@ -251,7 +251,7 @@ class CategoryReportController extends Controller
$newSet[$key] = $chartData[$key];
}
}
if (0 === count($newSet)) {
if (0 === \count($newSet)) {
$newSet = $chartData;
}
$data = $this->generator->multiSet($newSet);

View File

@@ -173,7 +173,7 @@ class ExpenseReportController extends Controller
$newSet[$key] = $chartData[$key];
}
}
if (0 === count($newSet)) {
if (0 === \count($newSet)) {
$newSet = $chartData; // @codeCoverageIgnore
}
$data = $this->generator->multiSet($newSet);

View File

@@ -245,7 +245,7 @@ class TagReportController extends Controller
$newSet[$key] = $chartData[$key];
}
}
if (0 === count($newSet)) {
if (0 === \count($newSet)) {
$newSet = $chartData; // @codeCoverageIgnore
}
$data = $this->generator->multiSet($newSet);

View File

@@ -92,7 +92,7 @@ class Controller extends BaseController
$shownDemo = true;
// either must be array and either must be > 0
if ((is_array($intro) || is_array($specialIntro)) && (count($intro) > 0 || count($specialIntro) > 0)) {
if ((\is_array($intro) || \is_array($specialIntro)) && (\count($intro) > 0 || \count($specialIntro) > 0)) {
$shownDemo = Preferences::get($key, false)->data;
Log::debug(sprintf('Check if user has already seen intro with key "%s". Result is %d', $key, $shownDemo));
}
@@ -157,7 +157,7 @@ class Controller extends BaseController
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
$account = $transaction->account;
if (in_array($account->accountType->type, $valid)) {
if (\in_array($account->accountType->type, $valid)) {
return redirect(route('accounts.show', [$account->id]));
}
}

View File

@@ -91,7 +91,7 @@ class ExportController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', strlen($content));
->header('Content-Length', \strlen($content));
return $response;
}

View File

@@ -93,7 +93,7 @@ class HelpController extends Controller
$content = $this->help->getFromGithub($route, $language);
// content will have 0 length when Github failed. Try en_US when it does:
if (0 === strlen($content)) {
if (0 === \strlen($content)) {
$language = 'en_US';
// also check cache first:
@@ -108,7 +108,7 @@ class HelpController extends Controller
}
// help still empty?
if (0 !== strlen($content)) {
if (0 !== \strlen($content)) {
$this->help->putInCache($route, $language, $content);
return $content;

View File

@@ -211,7 +211,7 @@ class HomeController extends Controller
/** @var Route $route */
foreach ($set as $route) {
$name = $route->getName();
if (null !== $name && in_array('GET', $route->methods()) && strlen($name) > 0) {
if (null !== $name && \in_array('GET', $route->methods()) && \strlen($name) > 0) {
$found = false;
foreach ($ignore as $string) {

View File

@@ -114,7 +114,7 @@ class ConfigurationController extends Controller
// get possible warning from configurator:
$warning = $configurator->getWarningMessage();
if (strlen($warning) > 0) {
if (\strlen($warning) > 0) {
$request->session()->flash('warning', $warning);
}

View File

@@ -115,7 +115,7 @@ class IndexController extends Controller
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', strlen($result));
->header('Content-Length', \strlen($result));
return $response;
}

View File

@@ -59,7 +59,7 @@ class StatusController extends Controller
public function index(ImportJob $job)
{
$statuses = ['configured', 'running', 'finished', 'error'];
if (!in_array($job->status, $statuses)) {
if (!\in_array($job->status, $statuses)) {
return redirect(route('import.configure', [$job->key]));
}
$subTitle = trans('import.status_sub_title');

View File

@@ -158,7 +158,7 @@ class BoxController extends Controller
'incomes' => $incomes,
'expenses' => $expenses,
'sums' => $sums,
'size' => count($sums),
'size' => \count($sums),
];
$cache->store($response);

View File

@@ -35,8 +35,7 @@ class FrontpageController extends Controller
* @param PiggyBankRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function piggyBanks(PiggyBankRepositoryInterface $repository)
{
@@ -61,7 +60,7 @@ class FrontpageController extends Controller
}
}
$html = '';
if (count($info) > 0) {
if (\count($info) > 0) {
$html = view('json.piggy-banks', compact('info'))->render();
}

View File

@@ -43,7 +43,7 @@ class IntroController
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
if (0 === \count($specificSteps)) {
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return response()->json($steps);
@@ -51,7 +51,7 @@ class IntroController
if ($this->hasOutroStep($route)) {
// @codeCoverageIgnoreStart
// save last step:
$lastStep = $steps[count($steps) - 1];
$lastStep = $steps[\count($steps) - 1];
// remove last step:
array_pop($steps);
// merge arrays and add last step again
@@ -136,7 +136,7 @@ class IntroController
$routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey));
$steps = [];
if (is_array($elements) && count($elements) > 0) {
if (\is_array($elements) && \count($elements) > 0) {
foreach ($elements as $key => $options) {
$currentStep = $options;
@@ -147,7 +147,7 @@ class IntroController
$steps[] = $currentStep;
}
}
Log::debug(sprintf('Total basic steps for %s is %d', $routeKey, count($steps)));
Log::debug(sprintf('Total basic steps for %s is %d', $routeKey, \count($steps)));
return $steps;
}
@@ -164,10 +164,10 @@ class IntroController
$routeKey = '';
// user is on page with specific instructions:
if (strlen($specificPage) > 0) {
if (\strlen($specificPage) > 0) {
$routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey . '_' . $specificPage));
if (is_array($elements) && count($elements) > 0) {
if (\is_array($elements) && \count($elements) > 0) {
foreach ($elements as $key => $options) {
$currentStep = $options;
@@ -179,7 +179,7 @@ class IntroController
}
}
}
Log::debug(sprintf('Total specific steps for route "%s" and page "%s" (routeKey is "%s") is %d', $route, $specificPage, $routeKey, count($steps)));
Log::debug(sprintf('Total specific steps for route "%s" and page "%s" (routeKey is "%s") is %d', $route, $specificPage, $routeKey, \count($steps)));
return $steps;
}

View File

@@ -33,8 +33,7 @@ class JsonController extends Controller
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function action(Request $request)
{
@@ -53,6 +52,7 @@ class JsonController extends Controller
* @param Request $request
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function trigger(Request $request)
{

View File

@@ -273,7 +273,7 @@ class PiggyBankController extends Controller
// set all users piggy banks to zero:
$this->piggyRepos->reset();
if (is_array($data)) {
if (\is_array($data)) {
foreach ($data as $order => $id) {
$this->piggyRepos->setOrder((int)$id, $order + 1);
}

View File

@@ -114,11 +114,12 @@ class ReportController extends Controller
}
/**
* @param $attributes
* @param array $attributes
*
* @return string
*
* @throws FireflyException
* @throws \Throwable
*/
private function balanceAmount(array $attributes): string
{
@@ -155,8 +156,7 @@ class ReportController extends Controller
* @param array $attributes
*
* @return string
*
* @throws \Throwable
*/
private function budgetSpentAmount(array $attributes): string
{
@@ -173,8 +173,7 @@ class ReportController extends Controller
* @param array $attributes
*
* @return string
*
* @throws \Throwable
*/
private function categoryEntry(array $attributes): string
{
@@ -191,8 +190,7 @@ class ReportController extends Controller
* @param array $attributes
*
* @return string
*
* @throws \Throwable
*/
private function expenseEntry(array $attributes): string
{
@@ -209,8 +207,7 @@ class ReportController extends Controller
* @param array $attributes
*
* @return string
*
* @throws \Throwable
*/
private function incomeEntry(array $attributes): string
{

View File

@@ -94,7 +94,7 @@ class PreferencesController extends Controller
{
// front page accounts
$frontPageAccounts = [];
if (is_array($request->get('frontPageAccounts'))) {
if (\is_array($request->get('frontPageAccounts'))) {
foreach ($request->get('frontPageAccounts') as $id) {
$frontPageAccounts[] = (int)$id;
}

View File

@@ -40,7 +40,7 @@ class AccountController extends Controller
*
* @return mixed|string
*
* @throws \Throwable
*/
public function general(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -40,8 +40,7 @@ class BalanceController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -41,8 +41,7 @@ class BudgetController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -70,8 +69,7 @@ class BudgetController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function period(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -40,8 +40,7 @@ class CategoryController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
{
@@ -68,13 +67,13 @@ class CategoryController extends Controller
}
/**
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
*
* @return string
* @param Carbon $start
* @param Carbon $end
*
* @return string
* @throws \Throwable
*/
public function income(Collection $accounts, Carbon $start, Carbon $end)
{
@@ -107,9 +106,8 @@ class CategoryController extends Controller
*
* @return mixed|string
*
* @throws \Throwable
* @internal param ReportHelperInterface $helper
*
*/
public function operations(Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -67,8 +67,7 @@ class ExpenseController extends Controller
* @param Carbon $end
*
* @return string
*
* @throws \Throwable
*/
public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
@@ -115,8 +114,7 @@ class ExpenseController extends Controller
* @param Carbon $end
*
* @return string
*
* @throws \Throwable
*/
public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
@@ -173,8 +171,7 @@ class ExpenseController extends Controller
* @param Carbon $end
*
* @return array|mixed|string
*
* @throws \Throwable
*/
public function spent(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
@@ -218,8 +215,7 @@ class ExpenseController extends Controller
* @param Carbon $end
*
* @return string
*
* @throws \Throwable
*/
public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
@@ -262,8 +258,7 @@ class ExpenseController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{

View File

@@ -40,8 +40,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -69,8 +68,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return string
*
* @throws \Throwable
*/
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{
@@ -99,8 +97,7 @@ class OperationsController extends Controller
* @param Carbon $end
*
* @return mixed|string
*
* @throws \Throwable
*/
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
{

View File

@@ -415,8 +415,7 @@ class ReportController extends Controller
/**
* @return string
*
* @throws \Throwable
*/
private function accountReportOptions(): string
{
@@ -427,7 +426,7 @@ class ReportController extends Controller
$set = new Collection;
$names = $revenue->pluck('name')->toArray();
foreach ($expense as $exp) {
if (in_array($exp->name, $names)) {
if (\in_array($exp->name, $names)) {
$set->push($exp);
}
}
@@ -437,8 +436,7 @@ class ReportController extends Controller
/**
* @return string
*
* @throws \Throwable
*/
private function budgetReportOptions(): string
{
@@ -451,8 +449,7 @@ class ReportController extends Controller
/**
* @return string
*
* @throws \Throwable
*/
private function categoryReportOptions(): string
{
@@ -465,8 +462,7 @@ class ReportController extends Controller
/**
* @return string
*
* @throws \Throwable
*/
private function noReportOptions(): string
{
@@ -475,8 +471,7 @@ class ReportController extends Controller
/**
* @return string
*
* @throws \Throwable
*/
private function tagReportOptions(): string
{

View File

@@ -310,9 +310,8 @@ class RuleController extends Controller
}
/**
* @param Request $request
* @param RuleRepositoryInterface $repository
* @param Rule $rule
* @param Request $request
* @param Rule $rule
*
* @return JsonResponse
*/
@@ -452,7 +451,7 @@ class RuleController extends Controller
{
$triggers = $rule->ruleTriggers;
if (0 === count($triggers)) {
if (0 === \count($triggers)) {
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
}
@@ -682,7 +681,7 @@ class RuleController extends Controller
$newIndex = 0;
$actions = [];
/** @var array $oldActions */
$oldActions = is_array($request->old('rule-action')) ? $request->old('rule-action') : [];
$oldActions = \is_array($request->old('rule-action')) ? $request->old('rule-action') : [];
foreach ($oldActions as $index => $entry) {
$count = ($newIndex + 1);
$checked = isset($request->old('rule-action-stop')[$index]) ? true : false;
@@ -718,7 +717,7 @@ class RuleController extends Controller
$newIndex = 0;
$triggers = [];
/** @var array $oldTriggers */
$oldTriggers = is_array($request->old('rule-trigger')) ? $request->old('rule-trigger') : [];
$oldTriggers = \is_array($request->old('rule-trigger')) ? $request->old('rule-trigger') : [];
foreach ($oldTriggers as $index => $entry) {
$count = ($newIndex + 1);
$oldChecked = isset($request->old('rule-trigger-stop')[$index]) ? true : false;

View File

@@ -73,8 +73,7 @@ class SearchController extends Controller
* @param SearchInterface $searcher
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function search(Request $request, SearchInterface $searcher)
{

View File

@@ -213,7 +213,7 @@ class TagController extends Controller
}
// prep for "specific date" view.
if (strlen($moment) > 0 && 'all' !== $moment) {
if (\strlen($moment) > 0 && 'all' !== $moment) {
$start = new Carbon($moment);
$end = app('navigation')->endOfPeriod($start, $range);
$subTitle = trans(
@@ -226,7 +226,7 @@ class TagController extends Controller
}
// prep for current period
if (0 === strlen($moment)) {
if (0 === \strlen($moment)) {
/** @var Carbon $start */
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
/** @var Carbon $end */

View File

@@ -120,7 +120,7 @@ class MassController extends Controller
/**
* @param Collection $journals
*
* @return View
* @return IlluminateView
*/
public function edit(Collection $journals): IlluminateView
{
@@ -173,7 +173,7 @@ class MassController extends Controller
{
$journalIds = $request->get('journals');
$count = 0;
if (is_array($journalIds)) {
if (\is_array($journalIds)) {
foreach ($journalIds as $journalId) {
$journal = $repository->find((int)$journalId);
if (null !== $journal) {

View File

@@ -408,10 +408,10 @@ class SingleController extends Controller
$this->attachments->saveAttachmentsForModel($journal, $files);
// @codeCoverageIgnoreStart
if (count($this->attachments->getErrors()->get('attachments')) > 0) {
if (\count($this->attachments->getErrors()->get('attachments')) > 0) {
session()->flash('error', $this->attachments->getErrors()->get('attachments'));
}
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
if (\count($this->attachments->getMessages()->get('attachments')) > 0) {
session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
// @codeCoverageIgnoreEnd

View File

@@ -157,7 +157,7 @@ class SplitController extends Controller
// flash messages
// @codeCoverageIgnoreStart
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
if (\count($this->attachments->getMessages()->get('attachments')) > 0) {
session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
// @codeCoverageIgnoreEnd
@@ -253,7 +253,7 @@ class SplitController extends Controller
$res = $transformer->transform($transaction);
}
if (count($res) > 0) {
if (\count($res) > 0) {
$res['amount'] = app('steam')->positive((string)$res['amount']);
$res['foreign_amount'] = app('steam')->positive((string)$res['foreign_amount']);
$transactions[] = $res;
@@ -271,7 +271,7 @@ class SplitController extends Controller
*/
private function updateWithPrevious($array, $old): array
{
if (0 === count($old) || !isset($old['transactions'])) {
if (0 === \count($old) || !isset($old['transactions'])) {
return $array;
}
$old = $old['transactions'];

View File

@@ -175,7 +175,7 @@ class TransactionController extends Controller
{
$ids = $request->get('items');
$date = new Carbon($request->get('date'));
if (count($ids) > 0) {
if (\count($ids) > 0) {
$order = 0;
$ids = array_unique($ids);
foreach ($ids as $id) {