Code cleanup and realign.

This commit is contained in:
James Cole 2018-08-06 19:14:30 +02:00
parent f7eef25fed
commit 5908c0ce8c
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
188 changed files with 1019 additions and 1031 deletions

View File

@ -34,7 +34,6 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use League\Fractal\Manager; use League\Fractal\Manager;
use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection; use League\Fractal\Resource\Collection as FractalCollection;

View File

@ -54,6 +54,7 @@ class ConfigurationController extends Controller
$admin = auth()->user(); $admin = auth()->user();
if (!$this->repository->hasRole($admin, 'owner')) { if (!$this->repository->hasRole($admin, 'owner')) {
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
throw new FireflyException('No access to method.'); // @codeCoverageIgnore throw new FireflyException('No access to method.'); // @codeCoverageIgnore
} }

View File

@ -64,7 +64,7 @@ class Import extends Command
Log::debug('Start start-import command'); Log::debug('Start start-import command');
$jobKey = (string)$this->argument('key'); $jobKey = (string)$this->argument('key');
/** @var ImportJob $job */ /** @var ImportJob $job */
$job = ImportJob::where('key', $jobKey)->first(); $job = ImportJob::where('key', $jobKey)->first();
if (null === $job) { if (null === $job) {
$this->errorLine(sprintf('No job found with key "%s"', $jobKey)); $this->errorLine(sprintf('No job found with key "%s"', $jobKey));

View File

@ -82,6 +82,7 @@ class ScanAttachments extends Command
$attachment->save(); $attachment->save();
$this->line(sprintf('Fixed attachment #%d', $attachment->id)); $this->line(sprintf('Fixed attachment #%d', $attachment->id));
} }
return 0; return 0;
} }
} }

View File

@ -54,6 +54,7 @@ class UpgradeFireflyInstructions extends Command
if ('install' === (string)$this->argument('task')) { if ('install' === (string)$this->argument('task')) {
$this->installInstructions(); $this->installInstructions();
} }
return 0; return 0;
} }

View File

@ -62,6 +62,7 @@ class UseEncryption extends Command
$this->handleObjects('Category', 'name', 'encrypted'); $this->handleObjects('Category', 'name', 'encrypted');
$this->handleObjects('PiggyBank', 'name', 'encrypted'); $this->handleObjects('PiggyBank', 'name', 'encrypted');
$this->handleObjects('TransactionJournal', 'description', 'encrypted'); $this->handleObjects('TransactionJournal', 'description', 'encrypted');
return 0; return 0;
} }

View File

@ -36,10 +36,10 @@ class RequestedNewPassword extends Event
/** @var string The users IP address */ /** @var string The users IP address */
public $ipAddress; public $ipAddress;
/** @var User The user */
public $user;
/** @var string The token */ /** @var string The token */
public $token; public $token;
/** @var User The user */
public $user;
/** /**
* Create a new event instance. This event is triggered when a users tries to reset his or her password. * Create a new event instance. This event is triggered when a users tries to reset his or her password.

View File

@ -28,7 +28,6 @@ use Crypt;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
use Storage; use Storage;
@ -108,7 +107,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
if ($this->uploadDisk->exists($file)) { if ($this->uploadDisk->exists($file)) {
try { try {
$decrypted = Crypt::decrypt($this->uploadDisk->get($file)); $decrypted = Crypt::decrypt($this->uploadDisk->get($file));
} catch (FileNotFoundException|DecryptException $e) { } catch (DecryptException $e) {
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage()); Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
return false; return false;

View File

@ -54,7 +54,7 @@ class ExpandedProcessor implements ProcessorInterface
{ {
/** @var Collection All accounts */ /** @var Collection All accounts */
public $accounts; public $accounts;
/** @var string The export format*/ /** @var string The export format */
public $exportFormat; public $exportFormat;
/** @var bool Should include attachments */ /** @var bool Should include attachments */
public $includeAttachments; public $includeAttachments;
@ -62,7 +62,7 @@ class ExpandedProcessor implements ProcessorInterface
public $includeOldUploads; public $includeOldUploads;
/** @var ExportJob The export job itself */ /** @var ExportJob The export job itself */
public $job; public $job;
/** @var array The settings*/ /** @var array The settings */
public $settings; public $settings;
/** @var Collection The entries to export. */ /** @var Collection The entries to export. */
private $exportEntries; private $exportEntries;
@ -222,7 +222,7 @@ class ExpandedProcessor implements ProcessorInterface
{ {
$exporterClass = config('firefly.export_formats.' . $this->exportFormat); $exporterClass = config('firefly.export_formats.' . $this->exportFormat);
/** @var ExporterInterface $exporter */ /** @var ExporterInterface $exporter */
$exporter = app($exporterClass); $exporter = app($exporterClass);
$exporter->setJob($this->job); $exporter->setJob($this->job);
$exporter->setEntries($this->exportEntries); $exporter->setEntries($this->exportEntries);
$exporter->run(); $exporter->run();
@ -260,7 +260,7 @@ class ExpandedProcessor implements ProcessorInterface
/** /**
* Delete files. * Delete files.
*/ */
private function deleteFiles():void private function deleteFiles(): void
{ {
$disk = Storage::disk('export'); $disk = Storage::disk('export');
foreach ($this->getFiles() as $file) { foreach ($this->getFiles() as $file) {

View File

@ -104,7 +104,7 @@ class TransactionJournalFactory
// store date meta fields (if present): // store date meta fields (if present):
$fields = ['sepa-cc', 'sepa-ct-op', 'sepa-ct-id', 'sepa-db', 'sepa-country', 'sepa-ep', 'sepa-ci', 'interest_date', 'book_date', 'process_date', $fields = ['sepa-cc', 'sepa-ct-op', 'sepa-ct-id', 'sepa-db', 'sepa-country', 'sepa-ep', 'sepa-ci', 'interest_date', 'book_date', 'process_date',
'due_date', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2', 'due_date', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2',
'external_id','sepa-batch-id']; 'external_id', 'sepa-batch-id'];
foreach ($fields as $field) { foreach ($fields as $field) {
$this->storeMeta($journal, $data, $field); $this->storeMeta($journal, $data, $field);

View File

@ -78,15 +78,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
// render! // render!
try { try {
$result= view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses')) $result = view('reports.budget.month', compact('accountIds', 'budgetIds', 'accountSummary', 'budgetSummary', 'averageExpenses', 'topExpenses'))
->with('start', $this->start)->with('end', $this->end) ->with('start', $this->start)->with('end', $this->end)
->with('budgets', $this->budgets) ->with('budgets', $this->budgets)
->with('accounts', $this->accounts) ->with('accounts', $this->accounts)
->render(); ->render();
} catch (Throwable $e) { } catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage())); Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));
$result = 'Could not render report view.'; $result = 'Could not render report view.';
} }
return $result; return $result;
} }

View File

@ -90,8 +90,9 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
try { try {
$result = view( $result = view(
'reports.tag.month', compact( 'reports.tag.month', compact(
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome', 'topExpenses' 'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome',
) 'topExpenses'
)
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render(); )->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
} catch (Throwable $e) { } catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage())); Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));

View File

@ -27,14 +27,12 @@ namespace FireflyIII\Handlers\Events;
use FireflyConfig; use FireflyConfig;
use FireflyIII\Events\RequestedVersionCheckStatus; use FireflyIII\Events\RequestedVersionCheckStatus;
use FireflyIII\Helpers\Update\UpdateTrait; use FireflyIII\Helpers\Update\UpdateTrait;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Log; use Log;
/** /**
* Class VersionCheckEventHandler * Class VersionCheckEventHandler
*/ */
@ -81,7 +79,7 @@ class VersionCheckEventHandler
$latestRelease = $this->getLatestRelease(); $latestRelease = $this->getLatestRelease();
$versionCheck = $this->versionCheck($latestRelease); $versionCheck = $this->versionCheck($latestRelease);
$resultString = $this->parseResult($versionCheck, $latestRelease); $resultString = $this->parseResult($versionCheck, $latestRelease);
if (0 !== $versionCheck && '' !== $resultString) { if (0 !== $versionCheck && '' !== $resultString) {
// flash info // flash info
session()->flash('info', $resultString); session()->flash('info', $resultString);

View File

@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Attachments;
use Crypt; use Crypt;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag; use Illuminate\Support\MessageBag;
@ -80,7 +79,7 @@ class AttachmentHelper implements AttachmentHelperInterface
try { try {
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id))); $content = Crypt::decrypt($this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)));
} catch (DecryptException|FileNotFoundException $e) { } catch (DecryptException $e) {
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage())); Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$content = ''; $content = '';
} }

View File

@ -160,6 +160,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
{ {
$set = $balance->getBalanceLines(); $set = $balance->getBalanceLines();
$newSet = new Collection; $newSet = new Collection;
/** @var BalanceLine $entry */
foreach ($set as $entry) { foreach ($set as $entry) {
if (null !== $entry->getBudget()->id) { if (null !== $entry->getBudget()->id) {
$sum = '0'; $sum = '0';

View File

@ -107,7 +107,7 @@ class CreateController extends Controller
} }
$request->session()->forget('accounts.create.fromStore'); $request->session()->forget('accounts.create.fromStore');
return view('accounts.create', compact('subTitleIcon', 'what','interestPeriods', 'subTitle', 'roles', 'liabilityTypes')); return view('accounts.create', compact('subTitleIcon', 'what', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes'));
} }

View File

@ -147,7 +147,7 @@ class ReconcileController extends Controller
/** @var Carbon $start */ /** @var Carbon $start */
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range)); $start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
/** @var Carbon $end */ /** @var Carbon $end */
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range)); $end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
} }
if (null === $end) { if (null === $end) {
/** @var Carbon $end */ /** @var Carbon $end */

View File

@ -93,7 +93,7 @@ class ShowController extends Controller
/** @var Carbon $start */ /** @var Carbon $start */
$start = $start ?? session('start'); $start = $start ?? session('start');
/** @var Carbon $end */ /** @var Carbon $end */
$end = $end ?? session('end'); $end = $end ?? session('end');
if ($end < $start) { if ($end < $start) {
throw new FireflyException('End is after start!'); // @codeCoverageIgnore throw new FireflyException('End is after start!'); // @codeCoverageIgnore
} }

View File

@ -55,6 +55,7 @@ class LinkController extends Controller
/** /**
* Make a new link form. * Make a new link form.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/ */
public function create() public function create()

View File

@ -28,7 +28,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Http\Requests\BillFormRequest; use FireflyIII\Http\Requests\BillFormRequest;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\TransactionRules\TransactionMatcher; use FireflyIII\TransactionRules\TransactionMatcher;
use FireflyIII\Transformers\BillTransformer; use FireflyIII\Transformers\BillTransformer;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@ -51,8 +50,6 @@ class BillController extends Controller
private $attachments; private $attachments;
/** @var BillRepositoryInterface Bill repository */ /** @var BillRepositoryInterface Bill repository */
private $billRepository; private $billRepository;
/** @var RuleGroupRepositoryInterface Rule group repository */
private $ruleGroupRepos;
/** /**
* BillController constructor. * BillController constructor.
@ -72,7 +69,6 @@ class BillController extends Controller
app('view')->share('mainTitleIcon', 'fa-calendar-o'); app('view')->share('mainTitleIcon', 'fa-calendar-o');
$this->attachments = app(AttachmentHelperInterface::class); $this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class); $this->billRepository = app(BillRepositoryInterface::class);
$this->ruleGroupRepos = app(RuleGroupRepositoryInterface::class);
return $next($request); return $next($request);
} }

View File

@ -78,9 +78,9 @@ class IndexController extends Controller
public function index(Request $request, string $moment = null) public function index(Request $request, string $moment = null)
{ {
/** @var string $range */ /** @var string $range */
$range = app('preferences')->get('viewRange', '1M')->data; $range = app('preferences')->get('viewRange', '1M')->data;
/** @var Carbon $start */ /** @var Carbon $start */
$start = session('start', new Carbon); $start = session('start', new Carbon);
/** @var Carbon $end */ /** @var Carbon $end */
$end = session('end', new Carbon); $end = session('end', new Carbon);
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page'); $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
@ -92,7 +92,7 @@ class IndexController extends Controller
try { try {
$start = new Carbon($moment); $start = new Carbon($moment);
/** @var Carbon $end */ /** @var Carbon $end */
$end = app('navigation')->endOfPeriod($start, $range); $end = app('navigation')->endOfPeriod($start, $range);
} catch (Exception $e) { } catch (Exception $e) {
// start and end are already defined. // start and end are already defined.
Log::debug(sprintf('start and end are already defined: %s', $e->getMessage())); Log::debug(sprintf('start and end are already defined: %s', $e->getMessage()));

View File

@ -127,7 +127,7 @@ class ShowController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath(route('budgets.no-budget')); $transactions->setPath(route('budgets.no-budget'));
return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'start', 'end')); return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'start', 'end'));
} }

View File

@ -29,7 +29,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter; use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Illuminate\Http\Request; use Illuminate\Http\Request;

View File

@ -129,6 +129,7 @@ class AccountController extends Controller
if ($cache->has()) { if ($cache->has()) {
return response()->json($cache->get()); // @codeCoverageIgnore return response()->json($cache->get()); // @codeCoverageIgnore
} }
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withBudgetInformation()->setTypes([TransactionType::WITHDRAWAL]); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withBudgetInformation()->setTypes([TransactionType::WITHDRAWAL]);
$transactions = $collector->getJournals(); $transactions = $collector->getJournals();
@ -192,6 +193,7 @@ class AccountController extends Controller
return response()->json($cache->get()); // @codeCoverageIgnore return response()->json($cache->get()); // @codeCoverageIgnore
} }
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::WITHDRAWAL]); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::WITHDRAWAL]);
$transactions = $collector->getJournals(); $transactions = $collector->getJournals();
@ -283,6 +285,7 @@ class AccountController extends Controller
} }
// grab all journals: // grab all journals:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::DEPOSIT]); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionType::DEPOSIT]);
$transactions = $collector->getJournals(); $transactions = $collector->getJournals();

View File

@ -102,7 +102,8 @@ class BillController extends Controller
} }
$results = $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->getJournals(); $results = $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->getJournals();
$results = $results->sortBy( /** @var Collection $results */
$results = $results->sortBy(
function (Transaction $transaction) { function (Transaction $transaction) {
return $transaction->date->format('U'); return $transaction->date->format('U');
} }

View File

@ -325,12 +325,12 @@ class BudgetController extends Controller
/** /**
* Shows a budget list with spent/left/overspent. * Shows a budget list with spent/left/overspent.
* *
* @return \Symfony\Component\HttpFoundation\Response * @return JsonResponse
* *
* @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/ */
public function frontpage(): \Symfony\Component\HttpFoundation\Response public function frontpage(): JsonResponse
{ {
$start = session('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());

View File

@ -168,6 +168,7 @@ class Controller extends BaseController
/** /**
* Get user's language. * Get user's language.
*
* @return string * @return string
*/ */
private function getLanguage(): string private function getLanguage(): string

View File

@ -78,7 +78,7 @@ class ExportController extends Controller
} }
$content = $repository->getContent($job); $content = $repository->getContent($job);
$job->change('export_downloaded'); $repository->changeStatus($job, 'export_downloaded');
/** @var LaravelResponse $response */ /** @var LaravelResponse $response */
$response = response($content, 200); $response = response($content, 200);
$response $response

View File

@ -108,7 +108,9 @@ class HomeController extends Controller
} }
$subTitle = (string)trans('firefly.welcomeBack'); $subTitle = (string)trans('firefly.welcomeBack');
$transactions = []; $transactions = [];
$frontPage = app('preferences')->get('frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray()); $frontPage = app('preferences')->get(
'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray()
);
/** @var Carbon $start */ /** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */ /** @var Carbon $end */

View File

@ -150,15 +150,15 @@ class JavascriptController extends Controller
{ {
$viewRange = app('preferences')->get('viewRange', '1M')->data; $viewRange = app('preferences')->get('viewRange', '1M')->data;
/** @var Carbon $start */ /** @var Carbon $start */
$start = session('start'); $start = session('start');
/** @var Carbon $end */ /** @var Carbon $end */
$end = session('end'); $end = session('end');
/** @var Carbon $first */ /** @var Carbon $first */
$first = session('first'); $first = session('first');
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat)); $title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
$isCustom = true === session('is_custom_range', false); $isCustom = true === session('is_custom_range', false);
$today = new Carbon; $today = new Carbon;
$ranges = [ $ranges = [
// first range is the current range: // first range is the current range:
$title => [$start, $end], $title => [$start, $end],
]; ];

View File

@ -202,7 +202,7 @@ class BoxController extends Controller
/** @var Carbon $start */ /** @var Carbon $start */
$start = session('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */ /** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties; $cache = new CacheProperties;
$cache->addProperty($start); $cache->addProperty($start);

View File

@ -80,6 +80,7 @@ class ReportController extends Controller
/** /**
* Generate popup view. * Generate popup view.
*
* @param Request $request * @param Request $request
* *
* @return JsonResponse * @return JsonResponse
@ -274,7 +275,7 @@ class ReportController extends Controller
$attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate']); $attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate']);
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {
Log::debug(sprintf('Not important error message: %s', $e->getMessage())); Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
$date = Carbon::now()->startOfMonth(); $date = Carbon::now()->startOfMonth();
$attributes['startDate'] = $date; $attributes['startDate'] = $date;
} }
@ -282,7 +283,7 @@ class ReportController extends Controller
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate']); $attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate']);
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {
Log::debug(sprintf('Not important error message: %s', $e->getMessage())); Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
$date = Carbon::now()->startOfMonth(); $date = Carbon::now()->startOfMonth();
$attributes['endDate'] = $date; $attributes['endDate'] = $date;
} }

View File

@ -340,6 +340,7 @@ class ProfileController extends Controller
session()->flash('success', (string)trans('firefly.saved_preferences')); session()->flash('success', (string)trans('firefly.saved_preferences'));
app('preferences')->mark(); app('preferences')->mark();
return redirect(route('profile.index')); return redirect(route('profile.index'));
} }
@ -371,6 +372,7 @@ class ProfileController extends Controller
/** /**
* Regenerate access token. * Regenerate access token.
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/ */
public function regenerate() public function regenerate()

View File

@ -86,7 +86,7 @@ class CreateController extends Controller
$this->rememberPreviousUri('recurring.create.uri'); $this->rememberPreviousUri('recurring.create.uri');
} }
$request->session()->forget('recurring.create.fromStore'); $request->session()->forget('recurring.create.fromStore');
$repetitionEnds = [ $repetitionEnds = [
'forever' => (string)trans('firefly.repeat_forever'), 'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => (string)trans('firefly.repeat_until_date'), 'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => (string)trans('firefly.repeat_times'), 'times' => (string)trans('firefly.repeat_times'),

View File

@ -86,7 +86,7 @@ class EditController extends Controller
$budgets = app('expandedform')->makeSelectListWithEmpty($this->budgets->getActiveBudgets()); $budgets = app('expandedform')->makeSelectListWithEmpty($this->budgets->getActiveBudgets());
/** @var RecurrenceRepetition $repetition */ /** @var RecurrenceRepetition $repetition */
$repetition = $recurrence->recurrenceRepetitions()->first(); $repetition = $recurrence->recurrenceRepetitions()->first();
$currentRepType = $repetition->repetition_type; $currentRepType = $repetition->repetition_type;
if ('' !== $repetition->repetition_moment) { if ('' !== $repetition->repetition_moment) {
$currentRepType .= ',' . $repetition->repetition_moment; $currentRepType .= ',' . $repetition->repetition_moment;

View File

@ -28,7 +28,6 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\RuleFormRequest; use FireflyIII\Http\Requests\RuleFormRequest;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleGroup;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Support\Http\Controllers\RuleManagement; use FireflyIII\Support\Http\Controllers\RuleManagement;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
@ -42,8 +41,6 @@ use Throwable;
class CreateController extends Controller class CreateController extends Controller
{ {
use RuleManagement; use RuleManagement;
/** @var BillRepositoryInterface Bill repository */
private $billRepos;
/** @var RuleRepositoryInterface Rule repository */ /** @var RuleRepositoryInterface Rule repository */
private $ruleRepos; private $ruleRepos;
@ -59,7 +56,6 @@ class CreateController extends Controller
app('view')->share('title', (string)trans('firefly.rules')); app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random'); app('view')->share('mainTitleIcon', 'fa-random');
$this->billRepos = app(BillRepositoryInterface::class);
$this->ruleRepos = app(RuleRepositoryInterface::class); $this->ruleRepos = app(RuleRepositoryInterface::class);
return $next($request); return $next($request);

View File

@ -130,7 +130,7 @@ class IndexController extends Controller
/** /**
* Move rule ip. * Move rule ip.
* *
* @param Rule $rule * @param Rule $rule
* *
* @return RedirectResponse|\Illuminate\Routing\Redirector * @return RedirectResponse|\Illuminate\Routing\Redirector

View File

@ -34,6 +34,7 @@ use phpseclib\Crypt\RSA;
/** /**
* Class InstallController * Class InstallController
*
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
class InstallController extends Controller class InstallController extends Controller

View File

@ -136,6 +136,7 @@ class LinkController extends Controller
/** /**
* Switch link from A <> B to B <> A. * Switch link from A <> B to B <> A.
*
* @param TransactionJournalLink $link * @param TransactionJournalLink $link
* *
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector

View File

@ -260,9 +260,9 @@ class TransactionController extends Controller
*/ */
private function getPeriodOverview(string $what, Carbon $date): Collection private function getPeriodOverview(string $what, Carbon $date): Collection
{ {
$range = app('preferences')->get('viewRange', '1M')->data; $range = app('preferences')->get('viewRange', '1M')->data;
$first = $this->repository->firstNull(); $first = $this->repository->firstNull();
$start = Carbon::now()->subYear(); $start = Carbon::now()->subYear();
$types = config('firefly.transactionTypesByWhat.' . $what); $types = config('firefly.transactionTypesByWhat.' . $what);
$entries = new Collection; $entries = new Collection;
if (null !== $first) { if (null !== $first) {
@ -289,9 +289,9 @@ class TransactionController extends Controller
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
$entries->push( $entries->push(
[ [
'name' => $dateName, 'name' => $dateName,
'sums' => $sums, 'sums' => $sums,
'sum' => $sum, 'sum' => $sum,
'start' => $currentDate['start']->format('Y-m-d'), 'start' => $currentDate['start']->format('Y-m-d'),
'end' => $currentDate['end']->format('Y-m-d'), 'end' => $currentDate['end']->format('Y-m-d'),
] ]

View File

@ -45,7 +45,7 @@ class TrustProxies extends Middleware
{ {
$trustedProxies = (string)env('TRUSTED_PROXIES', null); $trustedProxies = (string)env('TRUSTED_PROXIES', null);
$this->proxies = explode(',', $trustedProxies); $this->proxies = explode(',', $trustedProxies);
if ($trustedProxies === '**') { if ('**' === $trustedProxies) {
$this->proxies = '**'; $this->proxies = '**';
} }
parent::__construct($config); parent::__construct($config);

View File

@ -70,7 +70,7 @@ class AccountFormRequest extends Request
// if the account type is "liabilities" there are actually four types of liability // if the account type is "liabilities" there are actually four types of liability
// that could have been selected. // that could have been selected.
if ($data['accountType'] === 'liabilities') { if ('liabilities' === $data['accountType']) {
$data['accountType'] = null; $data['accountType'] = null;
$data['account_type_id'] = $this->integer('liability_type_id'); $data['account_type_id'] = $this->integer('liability_type_id');
// also reverse the opening balance: // also reverse the opening balance:

View File

@ -270,7 +270,7 @@ class JournalFormRequest extends Request
*/ */
private function validateDeposit(Validator $validator): void private function validateDeposit(Validator $validator): void
{ {
$data = $validator->getData(); $data = $validator->getData();
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0); $selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
$accountCurrency = (int)($data['destination_account_currency'] ?? 0); $accountCurrency = (int)($data['destination_account_currency'] ?? 0);
$nativeAmount = (string)($data['native_amount'] ?? ''); $nativeAmount = (string)($data['native_amount'] ?? '');
@ -290,7 +290,7 @@ class JournalFormRequest extends Request
*/ */
private function validateTransfer(Validator $validator): void private function validateTransfer(Validator $validator): void
{ {
$data = $validator->getData(); $data = $validator->getData();
$sourceCurrency = (int)($data['source_account_currency'] ?? 0); $sourceCurrency = (int)($data['source_account_currency'] ?? 0);
$destinationCurrency = (int)($data['destination_account_currency'] ?? 0); $destinationCurrency = (int)($data['destination_account_currency'] ?? 0);
$sourceAmount = (string)($data['source_amount'] ?? ''); $sourceAmount = (string)($data['source_amount'] ?? '');

View File

@ -150,7 +150,7 @@ class RecurrenceFormRequest extends Request
{ {
$today = new Carbon; $today = new Carbon;
$tomorrow = Carbon::now()->addDay(); $tomorrow = Carbon::now()->addDay();
$rules = [ $rules = [
// mandatory info for recurrence. // mandatory info for recurrence.
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title', 'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'first_date' => 'required|date|after:' . $today->format('Y-m-d'), 'first_date' => 'required|date|after:' . $today->format('Y-m-d'),

View File

@ -61,9 +61,10 @@ class Request extends FormRequest
public function float(string $field): ?float public function float(string $field): ?float
{ {
$res = $this->get($field); $res = $this->get($field);
if(null === $res) { if (null === $res) {
return null; return null;
} }
return (float)$res; return (float)$res;
} }

View File

@ -61,6 +61,7 @@ class RuleFormRequest extends Request
'rule_triggers' => $this->getRuleTriggerData(), 'rule_triggers' => $this->getRuleTriggerData(),
'rule_actions' => $this->getRuleActionData(), 'rule_actions' => $this->getRuleActionData(),
]; ];
return $data; return $data;
} }
@ -109,8 +110,8 @@ class RuleFormRequest extends Request
*/ */
private function getRuleActionData(): array private function getRuleActionData(): array
{ {
$return = []; $return = [];
$actionData= $this->get('rule_actions'); $actionData = $this->get('rule_actions');
if (\is_array($actionData)) { if (\is_array($actionData)) {
foreach ($actionData as $action) { foreach ($actionData as $action) {
$stopProcessing = $action['stop_processing'] ?? '0'; $stopProcessing = $action['stop_processing'] ?? '0';

View File

@ -33,6 +33,7 @@ class OpposingAccountIbans implements MapperInterface
{ {
/** /**
* Get map of opposing accounts. * Get map of opposing accounts.
*
* @return array * @return array
*/ */
public function getMap(): array public function getMap(): array

View File

@ -22,8 +22,8 @@ declare(strict_types=1);
namespace FireflyIII\Import\Prerequisites; namespace FireflyIII\Import\Prerequisites;
use bunq\Exception\BunqException;
use bunq\Util\BunqEnumApiEnvironmentType; use bunq\Util\BunqEnumApiEnvironmentType;
use Exception;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Services\Bunq\ApiContext; use FireflyIII\Services\Bunq\ApiContext;
use FireflyIII\Services\IP\IPRetrievalInterface; use FireflyIII\Services\IP\IPRetrievalInterface;
@ -134,7 +134,7 @@ class BunqPrerequisites implements PrerequisitesInterface
try { try {
$json = $apiContext->toJson(); $json = $apiContext->toJson();
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} catch (BunqException $e) { } catch (Exception $e) {
$messages = new MessageBag(); $messages = new MessageBag();
$messages->add('bunq_error', $e->getMessage()); $messages->add('bunq_error', $e->getMessage());

View File

@ -86,17 +86,18 @@ class YnabRoutine implements RoutineInterface
if (\count($budgets) > 1) { if (\count($budgets) > 1) {
$this->repository->setStage($this->importJob, 'select_budgets'); $this->repository->setStage($this->importJob, 'select_budgets');
$this->repository->setStatus($this->importJob, 'need_job_config'); $this->repository->setStatus($this->importJob, 'need_job_config');
return; return;
} }
if (\count($budgets) === 1) { if (1 === \count($budgets)) {
$this->repository->setStatus($this->importJob, 'ready_to_run'); $this->repository->setStatus($this->importJob, 'ready_to_run');
$this->repository->setStage($this->importJob, 'get_accounts'); $this->repository->setStage($this->importJob, 'get_accounts');
} }
return; return;
} }
if('get_accounts' === $this->importJob->stage) { if ('get_accounts' === $this->importJob->stage) {
$this->repository->setStatus($this->importJob, 'running'); $this->repository->setStatus($this->importJob, 'running');
/** @var GetAccountsHandler $handler */ /** @var GetAccountsHandler $handler */
@ -106,9 +107,10 @@ class YnabRoutine implements RoutineInterface
$this->repository->setStage($this->importJob, 'select_accounts'); $this->repository->setStage($this->importJob, 'select_accounts');
$this->repository->setStatus($this->importJob, 'need_job_config'); $this->repository->setStatus($this->importJob, 'need_job_config');
return; return;
} }
if('go-for-import' === $this->importJob->stage) { if ('go-for-import' === $this->importJob->stage) {
$this->repository->setStatus($this->importJob, 'running'); $this->repository->setStatus($this->importJob, 'running');
$this->repository->setStage($this->importJob, 'do_import'); $this->repository->setStage($this->importJob, 'do_import');
/** @var ImportDataHandler $handler */ /** @var ImportDataHandler $handler */
@ -117,26 +119,27 @@ class YnabRoutine implements RoutineInterface
$handler->run(); $handler->run();
$this->repository->setStatus($this->importJob, 'provider_finished'); $this->repository->setStatus($this->importJob, 'provider_finished');
$this->repository->setStage($this->importJob, 'final'); $this->repository->setStage($this->importJob, 'final');
return; return;
} }
// if ('match_accounts' === $this->importJob->stage) { // if ('match_accounts' === $this->importJob->stage) {
// // $this->repository->setStatus($this->importJob, 'running'); // // $this->repository->setStatus($this->importJob, 'running');
// /** @var StageGetBudgetsHandler $handler */ // /** @var StageGetBudgetsHandler $handler */
// $handler = app(StageGetBudgetsHandler::class); // $handler = app(StageGetBudgetsHandler::class);
// $handler->setImportJob($this->importJob); // $handler->setImportJob($this->importJob);
// $handler->run(); // $handler->run();
// $this->repository->setStage($this->importJob, 'get_transactions'); // $this->repository->setStage($this->importJob, 'get_transactions');
// } // }
// //
// if ('get_transactions' === $this->importJob->stage) { // if ('get_transactions' === $this->importJob->stage) {
// // $this->repository->setStatus($this->importJob, 'running'); // // $this->repository->setStatus($this->importJob, 'running');
// /** @var StageGetBudgetsHandler $handler */ // /** @var StageGetBudgetsHandler $handler */
// $handler = app(StageGetBudgetsHandler::class); // $handler = app(StageGetBudgetsHandler::class);
// $handler->setImportJob($this->importJob); // $handler->setImportJob($this->importJob);
// $handler->run(); // $handler->run();
// $this->repository->setStage($this->importJob, 'get_transactions'); // $this->repository->setStage($this->importJob, 'get_transactions');
// } // }
throw new FireflyException(sprintf('YNAB import routine cannot handle stage "%s"', $this->importJob->stage)); throw new FireflyException(sprintf('YNAB import routine cannot handle stage "%s"', $this->importJob->stage));
} }
} }

View File

@ -55,7 +55,7 @@ class CreateRecurringTransactions implements ShouldQueue
/** @var Carbon The current date */ /** @var Carbon The current date */
private $date; private $date;
/** @var JournalRepositoryInterface Journal repository */ /** @var JournalRepositoryInterface Journal repository */
private $journalRepository; private $journalRepository;
/** @var RecurringRepositoryInterface Recurring transactions repository. */ /** @var RecurringRepositoryInterface Recurring transactions repository. */
private $repository; private $repository;
@ -155,6 +155,7 @@ class CreateRecurringTransactions implements ShouldQueue
function (Rule $rule) use ($journal) { function (Rule $rule) use ($journal) {
Log::debug(sprintf('Going to apply rule #%d to journal %d.', $rule->id, $journal->id)); Log::debug(sprintf('Going to apply rule #%d to journal %d.', $rule->id, $journal->id));
$processor = Processor::make($rule); $processor = Processor::make($rule);
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
$processor->handleTransactionJournal($journal); $processor->handleTransactionJournal($journal);
if ($rule->stop_processing) { if ($rule->stop_processing) {
return; return;

View File

@ -35,32 +35,32 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/ */
class AccountType extends Model class AccountType extends Model
{ {
/** @var string */ /** @var string */
public const DEFAULT = 'Default account'; public const DEFAULT = 'Default account';
/** @var string */ /** @var string */
public const CASH = 'Cash account'; public const CASH = 'Cash account';
/** @var string */ /** @var string */
public const ASSET = 'Asset account'; public const ASSET = 'Asset account';
/** @var string */ /** @var string */
public const EXPENSE = 'Expense account'; public const EXPENSE = 'Expense account';
/** @var string */ /** @var string */
public const REVENUE = 'Revenue account'; public const REVENUE = 'Revenue account';
/** @var string */ /** @var string */
public const INITIAL_BALANCE = 'Initial balance account'; public const INITIAL_BALANCE = 'Initial balance account';
/** @var string */ /** @var string */
public const BENEFICIARY = 'Beneficiary account'; public const BENEFICIARY = 'Beneficiary account';
/** @var string */ /** @var string */
public const IMPORT = 'Import account'; public const IMPORT = 'Import account';
/** @var string */ /** @var string */
public const RECONCILIATION = 'Reconciliation account'; public const RECONCILIATION = 'Reconciliation account';
/** @var string */ /** @var string */
public const LOAN = 'Loan'; public const LOAN = 'Loan';
/** @var string */ /** @var string */
public const DEBT = 'Debt'; public const DEBT = 'Debt';
/** @var string */ /** @var string */
public const MORTGAGE = 'Mortgage'; public const MORTGAGE = 'Mortgage';
/** @var string */ /** @var string */
public const CREDITCARD = 'Credit card'; public const CREDITCARD = 'Credit card';
/** /**
* The attributes that should be casted to native types. * The attributes that should be casted to native types.
* *

View File

@ -84,7 +84,7 @@ class Attachment extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Attachment $attachment */ /** @var Attachment $attachment */
$attachment = $user->attachments()->find($attachmentId); $attachment = $user->attachments()->find($attachmentId);
if (null !== $attachment) { if (null !== $attachment) {
return $attachment; return $attachment;
} }

View File

@ -76,7 +76,7 @@ class AvailableBudget extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var AvailableBudget $availableBudget */ /** @var AvailableBudget $availableBudget */
$availableBudget = $user->availableBudgets()->find($availableBudgetId); $availableBudget = $user->availableBudgets()->find($availableBudgetId);
if (null !== $availableBudget) { if (null !== $availableBudget) {
return $availableBudget; return $availableBudget;
} }

View File

@ -110,9 +110,9 @@ class Bill extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany * @return MorphMany
*/ */
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany public function attachments(): MorphMany
{ {
return $this->morphMany(Attachment::class, 'attachable'); return $this->morphMany(Attachment::class, 'attachable');
} }

View File

@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $user_id * @property int $user_id
* @property-read string $email * @property-read string $email
* @property bool encrypted * @property bool encrypted
* @property Collection budgetlimits * @property Collection budgetlimits
*/ */
class Budget extends Model class Budget extends Model
{ {
@ -80,7 +80,7 @@ class Budget extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Budget $budget */ /** @var Budget $budget */
$budget = $user->budgets()->find($budgetId); $budget = $user->budgets()->find($budgetId);
if (null !== $budget) { if (null !== $budget) {
return $budget; return $budget;
} }

View File

@ -48,7 +48,7 @@ class BudgetLimit extends Model
* @var array * @var array
*/ */
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'start_date' => 'date', 'start_date' => 'date',

View File

@ -39,7 +39,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id * @property int $id
* @property float $spent // used in category reports * @property float $spent // used in category reports
* @property Carbon|null lastActivity * @property Carbon|null lastActivity
* @property bool encrypted * @property bool encrypted
*/ */
class Category extends Model class Category extends Model
{ {
@ -77,7 +77,7 @@ class Category extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Category $category */ /** @var Category $category */
$category = $user->categories()->find($categoryId); $category = $user->categories()->find($categoryId);
if (null !== $category) { if (null !== $category) {
return $category; return $category;
} }

View File

@ -46,8 +46,8 @@ class CurrencyExchangeRate extends Model
/** @var array Convert these fields to other data types */ /** @var array Convert these fields to other data types */
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'user_id' => 'int', 'user_id' => 'int',
'from_currency_id' => 'int', 'from_currency_id' => 'int',
'to_currency_id' => 'int', 'to_currency_id' => 'int',

View File

@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
@ -43,7 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Tag $tag * @property Tag $tag
* @property array $errors * @property array $errors
* @property array extended_status * @property array extended_status
* @property int id * @property int id
*/ */
class ImportJob extends Model class ImportJob extends Model
{ {
@ -77,7 +78,7 @@ class ImportJob extends Model
public static function routeBinder(string $value): ImportJob public static function routeBinder(string $value): ImportJob
{ {
if (auth()->check()) { if (auth()->check()) {
$key = trim($value); $key = trim($value);
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var ImportJob $importJob */ /** @var ImportJob $importJob */
@ -91,9 +92,9 @@ class ImportJob extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany * @return MorphMany
*/ */
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany public function attachments(): MorphMany
{ {
return $this->morphMany(Attachment::class, 'attachable'); return $this->morphMany(Attachment::class, 'attachable');
} }

View File

@ -45,7 +45,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $order * @property int $order
* @property bool $active * @property bool $active
* @property int $account_id * @property int $account_id
* @property bool encrypted * @property bool encrypted
* *
*/ */
class PiggyBank extends Model class PiggyBank extends Model

View File

@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $transaction_journal_id * @property int $transaction_journal_id
* @property int $piggy_bank_id * @property int $piggy_bank_id
* @property int $id * @property int $id
* @property Carbon date * @property Carbon date
*/ */
class PiggyBankEvent extends Model class PiggyBankEvent extends Model
{ {

View File

@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon $updated_at * @property Carbon $updated_at
* @property Carbon $created_at * @property Carbon $created_at
* @property int $id * @property int $id
* @property User user * @property User user
*/ */
class Preference extends Model class Preference extends Model
{ {
@ -74,7 +74,7 @@ class Preference extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Preference $preference */ /** @var Preference $preference */
$preference = $user->preferences()->find($preferenceId); $preference = $user->preferences()->find($preferenceId);
if (null !== $preference) { if (null !== $preference) {
return $preference; return $preference;
} }

View File

@ -103,7 +103,7 @@ class Recurrence extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Recurrence $recurrence */ /** @var Recurrence $recurrence */
$recurrence = $user->recurrences()->find($recurrenceId); $recurrence = $user->recurrences()->find($recurrenceId);
if (null !== $recurrence) { if (null !== $recurrence) {
return $recurrence; return $recurrence;
} }

View File

@ -57,7 +57,7 @@ class RecurrenceRepetition extends Model
* @var array * @var array
*/ */
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'deleted_at' => 'datetime', 'deleted_at' => 'datetime',

View File

@ -43,7 +43,7 @@ class RecurrenceTransactionMeta extends Model
* @var array * @var array
*/ */
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'deleted_at' => 'datetime', 'deleted_at' => 'datetime',

View File

@ -88,7 +88,7 @@ class Rule extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var Rule $rule */ /** @var Rule $rule */
$rule = $user->rules()->find($ruleId); $rule = $user->rules()->find($ruleId);
if (null !== $rule) { if (null !== $rule) {
return $rule; return $rule;
} }

View File

@ -43,7 +43,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id * @property int $id
* @property int $order * @property int $order
* @property Collection $rules * @property Collection $rules
* @property string description * @property string description
*/ */
class RuleGroup extends Model class RuleGroup extends Model
{ {
@ -80,7 +80,7 @@ class RuleGroup extends Model
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var RuleGroup $ruleGroup */ /** @var RuleGroup $ruleGroup */
$ruleGroup = $user->ruleGroups()->find($ruleGroupId); $ruleGroup = $user->ruleGroups()->find($ruleGroupId);
if (null !== $ruleGroup) { if (null !== $ruleGroup) {
return $ruleGroup; return $ruleGroup;
} }

View File

@ -237,6 +237,7 @@ class Transaction extends Model
/** /**
* Check for transactions BEFORE the specified date. * Check for transactions BEFORE the specified date.
*
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param Builder $query * @param Builder $query

View File

@ -34,7 +34,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $symbol * @property string $symbol
* @property int $decimal_places * @property int $decimal_places
* @property int $id * @property int $id
* @property string name * @property string name
* *
*/ */
class TransactionCurrency extends Model class TransactionCurrency extends Model

View File

@ -150,9 +150,9 @@ class TransactionJournal extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany * @return MorphMany
*/ */
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany public function attachments(): MorphMany
{ {
return $this->morphMany(Attachment::class, 'attachable'); return $this->morphMany(Attachment::class, 'attachable');
} }

View File

@ -45,9 +45,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/ */
class TransactionJournalLink extends Model class TransactionJournalLink extends Model
{ {
/** @var string The table to store the data in */
protected $table = 'journal_links';
/** /**
* The attributes that should be casted to native types. * The attributes that should be casted to native types.
* *
@ -55,9 +52,11 @@ class TransactionJournalLink extends Model
*/ */
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
]; ];
/** @var string The table to store the data in */
protected $table = 'journal_links';
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Laravel\Passport\Passport; use Laravel\Passport\Passport;
use URL; use URL;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* Class AppServiceProvider. * Class AppServiceProvider.
@ -38,7 +39,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
if('heroku' === env('APP_ENV')) { if ('heroku' === env('APP_ENV')) {
URL::forceScheme('https'); URL::forceScheme('https');
} }
} }

View File

@ -303,6 +303,7 @@ class AccountRepository implements AccountRepositoryInterface
if (null === $note) { if (null === $note) {
return null; return null;
} }
return $note->text; return $note->text;
} }
@ -450,6 +451,9 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data * @param array $data
* *
* @return Account * @return Account
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
* @throws FireflyException
*/ */
public function update(Account $account, array $data): Account public function update(Account $account, array $data): Account
{ {

View File

@ -50,6 +50,7 @@ interface AttachmentRepositoryInterface
/** /**
* @param int $attachmentId * @param int $attachmentId
*
* @return Attachment|null * @return Attachment|null
*/ */
public function findWithoutUser(int $attachmentId): ?Attachment; public function findWithoutUser(int $attachmentId): ?Attachment;

View File

@ -323,7 +323,7 @@ class BillRepository implements BillRepositoryInterface
*/ */
public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
{ {
$set = new Collection; $set = new Collection;
$currentStart = clone $start; $currentStart = clone $start;
Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq)); Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d'))); Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));

View File

@ -48,7 +48,8 @@ class ExportJobRepository implements ExportJobRepositoryInterface
public function changeStatus(ExportJob $job, string $status): bool public function changeStatus(ExportJob $job, string $status): bool
{ {
Log::debug(sprintf('Change status of job #%d to "%s"', $job->id, $status)); Log::debug(sprintf('Change status of job #%d to "%s"', $job->id, $status));
$job->change($status); $job->status = $status;
$job->save();
return true; return true;
} }

View File

@ -57,6 +57,7 @@ interface ExportJobRepositoryInterface
/** /**
* @param string $key * @param string $key
*
* @return ExportJob|null * @return ExportJob|null
*/ */
public function findByKey(string $key): ?ExportJob; public function findByKey(string $key): ?ExportJob;

View File

@ -184,6 +184,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
$newConfig = array_merge($currentConfig, $configuration); $newConfig = array_merge($currentConfig, $configuration);
$job->configuration = $newConfig; $job->configuration = $newConfig;
$job->save(); $job->save();
//Log::debug(sprintf('Set config of job "%s" to: ', $job->key), $newConfig); //Log::debug(sprintf('Set config of job "%s" to: ', $job->key), $newConfig);
return $job; return $job;

View File

@ -54,6 +54,7 @@ interface ImportJobRepositoryInterface
/** /**
* @param string $key * @param string $key
*
* @return ImportJob|null * @return ImportJob|null
*/ */
public function findByKey(string $key): ?ImportJob; public function findByKey(string $key): ?ImportJob;

View File

@ -707,6 +707,8 @@ class JournalRepository implements JournalRepositoryInterface
* *
* @return TransactionJournal * @return TransactionJournal
* *
* @throws FireflyException
* @throws FireflyException
*/ */
public function update(TransactionJournal $journal, array $data): TransactionJournal public function update(TransactionJournal $journal, array $data): TransactionJournal
{ {

View File

@ -25,7 +25,6 @@ namespace FireflyIII\Repositories\Journal;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionJournalMeta; use FireflyIII\Models\TransactionJournalMeta;

View File

@ -60,7 +60,7 @@ interface TagRepositoryInterface
* *
* @return Tag|null * @return Tag|null
*/ */
public function findByTag(string $tag):?Tag; public function findByTag(string $tag): ?Tag;
/** /**
* @param int $tagId * @param int $tagId

View File

@ -68,7 +68,7 @@ class FixerIOv2 implements ExchangeRateInterface
} }
// build URI // build URI
$uri = sprintf( $uri = sprintf(
'http://data.fixer.io/api/%s?access_key=%s&base=%s&symbols=%s', 'http://data.fixer.io/api/%s?access_key=%s&base=%s&symbols=%s',
$date->format('Y-m-d'), $apiKey, $fromCurrency->code, $toCurrency->code $date->format('Y-m-d'), $apiKey, $fromCurrency->code, $toCurrency->code
); );

View File

@ -60,7 +60,7 @@ class UpdateRequest implements GithubRequest
} }
try { try {
$releaseXml = new SimpleXMLElement($res->getBody()->getContents(), LIBXML_NOCDATA); $releaseXml = new SimpleXMLElement($res->getBody()->getContents(), LIBXML_NOCDATA);
} catch (RunTimeException $e) { } catch (RuntimeException $e) {
Log::error(sprintf('Could not get body from github updat result: %s', $e->getMessage())); Log::error(sprintf('Could not get body from github updat result: %s', $e->getMessage()));
$releaseXml = new SimpleXMLElement(''); $releaseXml = new SimpleXMLElement('');
} }

View File

@ -27,7 +27,7 @@ use Exception;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\GuzzleException;
use Log; use Log;
use RunTimeException; use RuntimeException;
/** /**
* Class IpifyOrg * Class IpifyOrg
@ -58,7 +58,7 @@ class IpifyOrg implements IPRetrievalInterface
} }
try { try {
$body = (string)$res->getBody()->getContents(); $body = (string)$res->getBody()->getContents();
} catch (RunTimeException $e) { } catch (RuntimeException $e) {
Log::error(sprintf('Could not get body from ipify.org result: %s', $e->getMessage())); Log::error(sprintf('Could not get body from ipify.org result: %s', $e->getMessage()));
$body = null; $body = null;
} }

View File

@ -49,7 +49,7 @@ trait AccountServiceTrait
/** @var array */ /** @var array */
public $validCCFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC']; public $validCCFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC'];
/** @var array */ /** @var array */
public $validFields = ['accountNumber', 'currency_id', 'BIC','interest','interest_period']; public $validFields = ['accountNumber', 'currency_id', 'BIC', 'interest', 'interest_period'];
/** /**
* @param Account $account * @param Account $account

View File

@ -22,6 +22,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace FireflyIII\Services\Internal\Support; namespace FireflyIII\Services\Internal\Support;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\TransactionTypeFactory; use FireflyIII\Factory\TransactionTypeFactory;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;

View File

@ -51,7 +51,7 @@ class BillUpdateService
$bill->repeat_freq = $data['repeat_freq']; $bill->repeat_freq = $data['repeat_freq'];
$bill->skip = $data['skip']; $bill->skip = $data['skip'];
$bill->automatch = true; $bill->automatch = true;
$bill->active = $data['active']??true; $bill->active = $data['active'] ?? true;
$bill->save(); $bill->save();
// update note: // update note:

View File

@ -25,7 +25,6 @@ namespace FireflyIII\Services\Internal\Update;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Recurrence; use FireflyIII\Models\Recurrence;
use FireflyIII\Services\Internal\Support\RecurringTransactionTrait; use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
use FireflyIII\Services\Internal\Support\TransactionServiceTrait; use FireflyIII\Services\Internal\Support\TransactionServiceTrait;
use FireflyIII\Services\Internal\Support\TransactionTypeTrait; use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
@ -65,7 +64,7 @@ class RecurrenceUpdateService
$recurrence->apply_rules = $data['recurrence']['apply_rules'] ?? $recurrence->apply_rules; $recurrence->apply_rules = $data['recurrence']['apply_rules'] ?? $recurrence->apply_rules;
$recurrence->active = $data['recurrence']['active'] ?? $recurrence->active; $recurrence->active = $data['recurrence']['active'] ?? $recurrence->active;
if(isset($data['recurrence']['repetition_end'])) { if (isset($data['recurrence']['repetition_end'])) {
if (\in_array($data['recurrence']['repetition_end'], ['forever ', 'until_date'])) { if (\in_array($data['recurrence']['repetition_end'], ['forever ', 'until_date'])) {
$recurrence->repetitions = 0; $recurrence->repetitions = 0;
} }

View File

@ -67,7 +67,7 @@ class PwndVerifierV2 implements Verifier
} }
try { try {
$strpos = stripos($res->getBody()->getContents(), $rest); $strpos = stripos($res->getBody()->getContents(), $rest);
} catch (RunTimeException $e) { } catch (RuntimeException $e) {
Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage())); Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage()));
$strpos = false; $strpos = false;
} }

View File

@ -28,6 +28,7 @@ use Carbon\Carbon;
/** /**
* *
* Class Attempt * Class Attempt
*
* @codeCoverageIgnore * @codeCoverageIgnore
* @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.TooManyFields)

View File

@ -28,6 +28,7 @@ use Carbon\Carbon;
/** /**
* Class Login * Class Login
*
* @codeCoverageIgnore * @codeCoverageIgnore
* @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.ShortVariable)
* @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.TooManyFields)

View File

@ -27,6 +27,7 @@ use Carbon\Carbon;
/** /**
* Class Transaction * Class Transaction
*
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.ShortVariable)

View File

@ -24,6 +24,7 @@ namespace FireflyIII\Services\Spectre\Request;
use FireflyIII\Services\Spectre\Object\Customer; use FireflyIII\Services\Spectre\Object\Customer;
use Log; use Log;
/** /**
* Class NewCustomerRequest * Class NewCustomerRequest
*/ */
@ -37,12 +38,12 @@ class NewCustomerRequest extends SpectreRequest
*/ */
public function call(): void public function call(): void
{ {
$data = [ $data = [
'data' => [ 'data' => [
'identifier' => 'default_ff3_customer', 'identifier' => 'default_ff3_customer',
], ],
]; ];
$uri = '/api/v4/customers/'; $uri = '/api/v4/customers/';
Log::debug(sprintf('Going to call %s with info:', $uri), $data); Log::debug(sprintf('Going to call %s with info:', $uri), $data);
$response = $this->sendSignedSpectrePost($uri, $data); $response = $this->sendSignedSpectrePost($uri, $data);
// create customer: // create customer:

View File

@ -211,7 +211,7 @@ abstract class SpectreRequest
$statusCode = $res->getStatusCode(); $statusCode = $res->getStatusCode();
try { try {
$returnBody = $res->getBody()->getContents(); $returnBody = $res->getBody()->getContents();
} catch (RunTimeException $e) { } catch (RuntimeException $e) {
Log::error(sprintf('Could not get body from SpectreRequest::GET result: %s', $e->getMessage())); Log::error(sprintf('Could not get body from SpectreRequest::GET result: %s', $e->getMessage()));
$returnBody = ''; $returnBody = '';
} }
@ -261,7 +261,7 @@ abstract class SpectreRequest
try { try {
$body = $res->getBody()->getContents(); $body = $res->getBody()->getContents();
} catch (RunTimeException $e) { } catch (RuntimeException $e) {
Log::error(sprintf('Could not get body from SpectreRequest::POST result: %s', $e->getMessage())); Log::error(sprintf('Could not get body from SpectreRequest::POST result: %s', $e->getMessage()));
$body = ''; $body = '';
} }

View File

@ -56,7 +56,7 @@ class Amount
$space = ' '; $space = ' ';
// require space between symbol and amount? // require space between symbol and amount?
if ($sepBySpace === false) { if (false === $sepBySpace) {
$space = ''; // no $space = ''; // no
} }
@ -134,8 +134,8 @@ class Amount
// some complicated switches to format the amount correctly: // some complicated switches to format the amount correctly:
$precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes']; $precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes'];
$separated = $amount < 0 ? $info['n_sep_by_space'] : $info['p_sep_by_space']; $separated = $amount < 0 ? $info['n_sep_by_space'] : $info['p_sep_by_space'];
$space = $separated === true ? ' ' : ''; $space = true === $separated ? ' ' : '';
$result = $precedes === false ? $formatted . $space . $format->symbol : $format->symbol . $space . $formatted; $result = false === $precedes ? $formatted . $space . $format->symbol : $format->symbol . $space . $formatted;
if (true === $coloured) { if (true === $coloured) {
if ($amount > 0) { if ($amount > 0) {

View File

@ -59,7 +59,7 @@ class SelectBudgetHandler implements YnabJobConfigurationInterface
Log::debug('Now in SelectBudgetHandler::configComplete'); Log::debug('Now in SelectBudgetHandler::configComplete');
$configuration = $this->repository->getConfiguration($this->importJob); $configuration = $this->repository->getConfiguration($this->importJob);
$selectedBudget = $configuration['selected_budget'] ?? ''; $selectedBudget = $configuration['selected_budget'] ?? '';
if ($selectedBudget !== '') { if ('' !== $selectedBudget) {
Log::debug(sprintf('Selected budget is %s, config is complete. Return true.', $selectedBudget)); Log::debug(sprintf('Selected budget is %s, config is complete. Return true.', $selectedBudget));
$this->repository->setStage($this->importJob, 'get_accounts'); $this->repository->setStage($this->importJob, 'get_accounts');

View File

@ -22,6 +22,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace FireflyIII\Support\Import\JobConfiguration\Ynab; namespace FireflyIII\Support\Import\JobConfiguration\Ynab;
use FireflyIII\Models\ImportJob; use FireflyIII\Models\ImportJob;
use Illuminate\Support\MessageBag; use Illuminate\Support\MessageBag;

View File

@ -147,6 +147,7 @@ class ImportableConverter
Log::error($e->getTraceAsString()); Log::error($e->getTraceAsString());
} }
} }
return $result; return $result;
} }

View File

@ -150,7 +150,7 @@ class ImportDataHandler
$destination = $this->mapper->map($possibleDestinationId, $amount, $destinationData); $destination = $this->mapper->map($possibleDestinationId, $amount, $destinationData);
if (1 === bccomp($amount, '0')) { if (1 === bccomp($amount, '0')) {
[$source, $destination] = [$destination, $source]; [$source, $destination] = [$destination, $source];
$type = $type === 'transfer' ? 'transfer' : 'deposit'; $type = 'transfer' === $type ? 'transfer' : 'deposit';
Log::debug(sprintf('Amount is %s, so switch source/dest and make this a %s', $amount, $type)); Log::debug(sprintf('Amount is %s, so switch source/dest and make this a %s', $amount, $type));
} }

Some files were not shown because too many files have changed in this diff Show More