diff --git a/app/Console/Commands/CreateImport.php b/app/Console/Commands/CreateImport.php index 41fd83d762..00ff5094c6 100644 --- a/app/Console/Commands/CreateImport.php +++ b/app/Console/Commands/CreateImport.php @@ -79,7 +79,8 @@ class CreateImport extends Command $this->info(sprintf('Type of import: %s', $type)); /** @var ImportJobRepositoryInterface $jobRepository */ - $jobRepository = app(ImportJobRepositoryInterface::class, [$user]); + $jobRepository = app(ImportJobRepositoryInterface::class); + $jobRepository->setUser($user); $job = $jobRepository->create($type); $this->line(sprintf('Created job "%s"...', $job->key)); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 8ea0f88014..f4a1e32559 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -39,9 +39,9 @@ class Kernel extends ConsoleKernel */ protected $bootstrappers = [ - 'Illuminate\Foundation\Bootstrap\DetectEnvironment', + 'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', - 'FireflyIII\Bootstrap\ConfigureLogging', + //'FireflyIII\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\SetRequestForConsole', diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.php index e068f32585..810dc1db85 100644 --- a/app/Export/Collector/AttachmentCollector.php +++ b/app/Export/Collector/AttachmentCollector.php @@ -43,10 +43,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface /** * AttachmentCollector constructor. - * - * @param ExportJob $job */ - public function __construct(ExportJob $job) + public function __construct() { /** @var AttachmentRepositoryInterface repository */ $this->repository = app(AttachmentRepositoryInterface::class); @@ -54,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface $this->uploadDisk = Storage::disk('upload'); $this->exportDisk = Storage::disk('export'); - parent::__construct($job); + parent::__construct(); } /** diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.php index 4fd571c84d..c80e8ec280 100644 --- a/app/Export/Collector/BasicCollector.php +++ b/app/Export/Collector/BasicCollector.php @@ -31,13 +31,10 @@ class BasicCollector /** * BasicCollector constructor. - * - * @param ExportJob $job */ - public function __construct(ExportJob $job) + public function __construct() { $this->entries = new Collection; - $this->job = $job; } /** @@ -56,5 +53,13 @@ class BasicCollector $this->entries = $entries; } + /** + * @param ExportJob $job + */ + public function setJob(ExportJob $job) + { + $this->job = $job; + } + } diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.php index f1778e9adc..54a3fa88a1 100644 --- a/app/Export/Collector/CollectorInterface.php +++ b/app/Export/Collector/CollectorInterface.php @@ -13,6 +13,7 @@ declare(strict_types = 1); namespace FireflyIII\Export\Collector; +use FireflyIII\Models\ExportJob; use Illuminate\Support\Collection; /** @@ -32,6 +33,13 @@ interface CollectorInterface */ public function run(): bool; + /** + * @param ExportJob $job + * + * @return mixed + */ + public function setJob(ExportJob $job); + /** * @param Collection $entries * diff --git a/app/Export/Collector/UploadCollector.php b/app/Export/Collector/UploadCollector.php index 1895cb8a5e..35c2e75188 100644 --- a/app/Export/Collector/UploadCollector.php +++ b/app/Export/Collector/UploadCollector.php @@ -14,7 +14,6 @@ declare(strict_types = 1); namespace FireflyIII\Export\Collector; use Crypt; -use FireflyIII\Models\ExportJob; use Illuminate\Contracts\Encryption\DecryptException; use Log; use Storage; @@ -35,22 +34,12 @@ class UploadCollector extends BasicCollector implements CollectorInterface /** * AttachmentCollector constructor. - * - * @param ExportJob $job */ - public function __construct(ExportJob $job) + public function __construct() { - parent::__construct($job); - - Log::debug('Going to collect attachments', ['key' => $job->key]); - - // make storage: + parent::__construct(); $this->uploadDisk = Storage::disk('upload'); $this->exportDisk = Storage::disk('export'); - - // file names associated with the old import routine. - $this->vintageFormat = sprintf('csv-upload-%d-', auth()->user()->id); - } /** @@ -60,6 +49,11 @@ class UploadCollector extends BasicCollector implements CollectorInterface */ public function run(): bool { + Log::debug('Going to collect attachments', ['key' => $this->job->key]); + + // file names associated with the old import routine. + $this->vintageFormat = sprintf('csv-upload-%d-', $this->job->user->id); + // collect old upload files (names beginning with "csv-upload". $this->collectVintageUploads(); diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.php index b16b19776a..256fa3b544 100644 --- a/app/Export/Exporter/BasicExporter.php +++ b/app/Export/Exporter/BasicExporter.php @@ -26,17 +26,15 @@ class BasicExporter { /** @var ExportJob */ protected $job; - private $entries; + /** @var Collection */ + private $entries; /** * BasicExporter constructor. - * - * @param ExportJob $job */ - public function __construct(ExportJob $job) + public function __construct() { $this->entries = new Collection; - $this->job = $job; } /** @@ -55,5 +53,13 @@ class BasicExporter $this->entries = $entries; } + /** + * @param ExportJob $job + */ + public function setJob(ExportJob $job) + { + $this->job = $job; + } + } diff --git a/app/Export/Exporter/CsvExporter.php b/app/Export/Exporter/CsvExporter.php index b1f12f4e30..200bf8116d 100644 --- a/app/Export/Exporter/CsvExporter.php +++ b/app/Export/Exporter/CsvExporter.php @@ -14,7 +14,6 @@ declare(strict_types = 1); namespace FireflyIII\Export\Exporter; use FireflyIII\Export\Entry\Entry; -use FireflyIII\Models\ExportJob; use League\Csv\Writer; use SplFileObject; @@ -30,13 +29,10 @@ class CsvExporter extends BasicExporter implements ExporterInterface /** * CsvExporter constructor. - * - * @param ExportJob $job */ - public function __construct(ExportJob $job) + public function __construct() { - parent::__construct($job); - + parent::__construct(); } /** diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.php index 3559d89cec..9e267b4812 100644 --- a/app/Export/Exporter/ExporterInterface.php +++ b/app/Export/Exporter/ExporterInterface.php @@ -13,6 +13,7 @@ declare(strict_types = 1); namespace FireflyIII\Export\Exporter; +use FireflyIII\Models\ExportJob; use Illuminate\Support\Collection; /** @@ -45,4 +46,9 @@ interface ExporterInterface */ public function setEntries(Collection $entries); + /** + * @param ExportJob $job + */ + public function setJob(ExportJob $job); + } diff --git a/app/Export/Processor.php b/app/Export/Processor.php index 0d0421a460..cbbdd2736b 100644 --- a/app/Export/Processor.php +++ b/app/Export/Processor.php @@ -19,7 +19,6 @@ use FireflyIII\Export\Collector\JournalExportCollector; use FireflyIII\Export\Collector\UploadCollector; use FireflyIII\Export\Entry\Entry; use FireflyIII\Models\ExportJob; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Support\Collection; use Log; use Storage; @@ -54,21 +53,12 @@ class Processor implements ProcessorInterface /** * Processor constructor. - * - * @param array $settings */ - public function __construct(array $settings) + public function __construct() { - // save settings - $this->settings = $settings; - $this->accounts = $settings['accounts']; - $this->exportFormat = $settings['exportFormat']; - $this->includeAttachments = $settings['includeAttachments']; - $this->includeOldUploads = $settings['includeOldUploads']; - $this->job = $settings['job']; - $this->journals = new Collection; - $this->exportEntries = new Collection; - $this->files = new Collection; + $this->journals = new Collection; + $this->exportEntries = new Collection; + $this->files = new Collection; } @@ -78,7 +68,8 @@ class Processor implements ProcessorInterface public function collectAttachments(): bool { /** @var AttachmentCollector $attachmentCollector */ - $attachmentCollector = app(AttachmentCollector::class, [$this->job]); + $attachmentCollector = app(AttachmentCollector::class); + $attachmentCollector->setJob($this->job); $attachmentCollector->setDates($this->settings['startDate'], $this->settings['endDate']); $attachmentCollector->run(); $this->files = $this->files->merge($attachmentCollector->getEntries()); @@ -92,7 +83,8 @@ class Processor implements ProcessorInterface public function collectJournals(): bool { /** @var JournalExportCollector $collector */ - $collector = app(JournalExportCollector::class, [$this->job]); + $collector = app(JournalExportCollector::class); + $collector->setJob($this->job); $collector->setDates($this->settings['startDate'], $this->settings['endDate']); $collector->setAccounts($this->settings['accounts']); $collector->run(); @@ -108,7 +100,8 @@ class Processor implements ProcessorInterface public function collectOldUploads(): bool { /** @var UploadCollector $uploadCollector */ - $uploadCollector = app(UploadCollector::class, [$this->job]); + $uploadCollector = app(UploadCollector::class); + $uploadCollector->setJob($this->job); $uploadCollector->run(); $this->files = $this->files->merge($uploadCollector->getEntries()); @@ -166,7 +159,8 @@ class Processor implements ProcessorInterface public function exportJournals(): bool { $exporterClass = config('firefly.export_formats.' . $this->exportFormat); - $exporter = app($exporterClass, [$this->job]); + $exporter = app($exporterClass); + $exporter->setJob($this->job); $exporter->setEntries($this->exportEntries); $exporter->run(); $this->files->push($exporter->getFileName()); @@ -182,6 +176,20 @@ class Processor implements ProcessorInterface return $this->files; } + /** + * @param array $settings + */ + public function setSettings(array $settings) + { + // save settings + $this->settings = $settings; + $this->accounts = $settings['accounts']; + $this->exportFormat = $settings['exportFormat']; + $this->includeAttachments = $settings['includeAttachments']; + $this->includeOldUploads = $settings['includeOldUploads']; + $this->job = $settings['job']; + } + /** * */ diff --git a/app/Export/ProcessorInterface.php b/app/Export/ProcessorInterface.php index 614d748304..540dbcaf37 100644 --- a/app/Export/ProcessorInterface.php +++ b/app/Export/ProcessorInterface.php @@ -25,11 +25,8 @@ interface ProcessorInterface /** * Processor constructor. - * - * @param array $settings - * */ - public function __construct(array $settings); + public function __construct(); /** * @return bool @@ -65,4 +62,9 @@ interface ProcessorInterface * @return Collection */ public function getFiles(): Collection; + + /** + * @param array $settings + */ + public function setSettings(array $settings); } diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 9c21b1a0ba..02cc9d08c2 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -139,7 +139,8 @@ class MonthReportGenerator implements ReportGeneratorInterface { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end); $journals = $collector->getJournals(); $journals = $journals->reverse(); diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php index 38a53aad79..3ab5227ecc 100644 --- a/app/Generator/Report/Budget/MonthReportGenerator.php +++ b/app/Generator/Report/Budget/MonthReportGenerator.php @@ -185,7 +185,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface } /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts)->setRange($this->start, $this->end) ->setTypes([TransactionType::WITHDRAWAL]) ->setBudgets($this->budgets)->withOpposingAccount()->disableFilter(); diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index 5517d7be13..865121006e 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -195,7 +195,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface } /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts)->setRange($this->start, $this->end) ->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER]) ->setCategories($this->categories)->withOpposingAccount()->disableFilter(); @@ -218,7 +219,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface } /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts)->setRange($this->start, $this->end) ->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER]) ->setCategories($this->categories)->withOpposingAccount(); diff --git a/app/Helpers/Chart/MetaPieChart.php b/app/Helpers/Chart/MetaPieChart.php index fbeb70cc25..e83b103ba0 100644 --- a/app/Helpers/Chart/MetaPieChart.php +++ b/app/Helpers/Chart/MetaPieChart.php @@ -85,7 +85,8 @@ class MetaPieChart implements MetaPieChartInterface // also collect all other transactions if ($this->collectOtherObjects && $direction === 'expense') { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL]); $journals = $collector->getJournals(); $sum = strval($journals->sum('transaction_amount')); @@ -96,7 +97,8 @@ class MetaPieChart implements MetaPieChartInterface if ($this->collectOtherObjects && $direction === 'income') { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::DEPOSIT]); $journals = $collector->getJournals(); $sum = strval($journals->sum('transaction_amount')); @@ -201,7 +203,8 @@ class MetaPieChart implements MetaPieChartInterface $modifier = 1; } /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts); $collector->setRange($this->start, $this->end); $collector->setTypes($types); @@ -258,7 +261,8 @@ class MetaPieChart implements MetaPieChartInterface { $chartData = []; $names = []; - $repository = app($this->repositories[$type], [$this->user]); + $repository = app($this->repositories[$type]); + $repository->setUser($this->user); foreach ($array as $objectId => $amount) { if (!isset($names[$objectId])) { $object = $repository->find(intval($objectId)); diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php index c198da7764..6e2d7a0d8e 100644 --- a/app/Helpers/Collector/JournalCollector.php +++ b/app/Helpers/Collector/JournalCollector.php @@ -96,17 +96,6 @@ class JournalCollector implements JournalCollectorInterface /** @var User */ private $user; - /** - * JournalCollector constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - $this->query = $this->startQuery(); - } - /** * @return int * @throws FireflyException @@ -168,7 +157,7 @@ class JournalCollector implements JournalCollectorInterface { $this->run = true; /** @var Collection $set */ - $set = $this->query->get(array_values($this->fields)); + $set = $this->query->get(array_values($this->fields)); Log::debug(sprintf('Count of set is %d', $set->count())); $set = $this->filterTransfers($set); Log::debug(sprintf('Count of set after filterTransfers() is %d', $set->count())); @@ -244,7 +233,8 @@ class JournalCollector implements JournalCollectorInterface public function setAllAssetAccounts(): JournalCollectorInterface { /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); $accounts = $repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]); if ($accounts->count() > 0) { $accountIds = $accounts->pluck('id')->toArray(); @@ -456,6 +446,37 @@ class JournalCollector implements JournalCollectorInterface return $this; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + + /** + * + */ + public function startQuery() + { + /** @var EloquentBuilder $query */ + $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id') + ->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id') + ->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id') + ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') + ->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id') + ->whereNull('transactions.deleted_at') + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_journals.user_id', $this->user->id) + ->orderBy('transaction_journals.date', 'DESC') + ->orderBy('transaction_journals.order', 'ASC') + ->orderBy('transaction_journals.id', 'DESC'); + + $this->query = $query; + + } + /** * @return JournalCollectorInterface */ @@ -729,27 +750,4 @@ class JournalCollector implements JournalCollectorInterface $this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'); } } - - /** - * @return EloquentBuilder - */ - private function startQuery(): EloquentBuilder - { - /** @var EloquentBuilder $query */ - $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id') - ->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id') - ->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id') - ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') - ->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id') - ->whereNull('transactions.deleted_at') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_journals.user_id', $this->user->id) - ->orderBy('transaction_journals.date', 'DESC') - ->orderBy('transaction_journals.order', 'ASC') - ->orderBy('transaction_journals.id', 'DESC'); - - return $query; - - } } diff --git a/app/Helpers/Collector/JournalCollectorInterface.php b/app/Helpers/Collector/JournalCollectorInterface.php index b3307ebac0..80e41eb781 100644 --- a/app/Helpers/Collector/JournalCollectorInterface.php +++ b/app/Helpers/Collector/JournalCollectorInterface.php @@ -17,6 +17,7 @@ use Carbon\Carbon; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\Tag; +use FireflyIII\User; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -27,7 +28,6 @@ use Illuminate\Support\Collection; */ interface JournalCollectorInterface { - /** * @return int */ @@ -84,7 +84,6 @@ interface JournalCollectorInterface */ public function setBudget(Budget $budget): JournalCollectorInterface; - /** * @param Collection $budgets * @@ -149,6 +148,13 @@ interface JournalCollectorInterface */ public function setTypes(array $types): JournalCollectorInterface; + public function setUser(User $user); + + /** + * + */ + public function startQuery(); + /** * @return JournalCollectorInterface */ diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 40b7b68eaf..f49805cd1b 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -68,7 +68,8 @@ class ReportHelper implements ReportHelperInterface /** @var BillRepositoryInterface $repository */ $repository = app(BillRepositoryInterface::class); $bills = $repository->getBillsForAccounts($accounts); - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($accounts)->setRange($start, $end)->setBills($bills); $journals = $collector->getJournals(); $collection = new BillCollection; diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index e68ee7f8bd..6ba0cc2248 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -23,7 +23,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI; use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; @@ -96,12 +95,12 @@ class AccountController extends Controller } /** - * @param ARI $repository - * @param Account $account + * @param AccountRepositoryInterface $repository + * @param Account $account * * @return View */ - public function delete(ARI $repository, Account $account) + public function delete(AccountRepositoryInterface $repository, Account $account) { $typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type); $subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]); @@ -118,12 +117,12 @@ class AccountController extends Controller /** * @param Request $request - * @param ARI $repository + * @param AccountRepositoryInterface $repository * @param Account $account * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ - public function destroy(Request $request, ARI $repository, Account $account) + public function destroy(Request $request, AccountRepositoryInterface $repository, Account $account) { $type = $account->accountType->type; $typeName = config('firefly.shortNamesByFullName.' . $type); @@ -191,12 +190,12 @@ class AccountController extends Controller } /** - * @param ARI $repository + * @param AccountRepositoryInterface $repository * @param string $what * * @return View */ - public function index(ARI $repository, string $what) + public function index(AccountRepositoryInterface $repository, string $what) { $what = $what ?? 'asset'; $subTitle = trans('firefly.' . $what . '_accounts'); @@ -262,7 +261,7 @@ class AccountController extends Controller /** * @param Request $request - * @param ARI $repository + * @param AccountRepositoryInterface $repository * @param Account $account * * @return View @@ -276,7 +275,8 @@ class AccountController extends Controller // replace with journal collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page); $journals = $collector->getPaginatedJournals(); $journals->setPath('accounts/show/' . $account->id . '/all'); @@ -310,7 +310,8 @@ class AccountController extends Controller // replace with journal collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page); $journals = $collector->getPaginatedJournals(); $journals->setPath('accounts/show/' . $account->id . '/' . $date); @@ -324,12 +325,12 @@ class AccountController extends Controller /** * @param AccountFormRequest $request - * @param ARI $repository + * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * */ - public function store(AccountFormRequest $request, ARI $repository) + public function store(AccountFormRequest $request, AccountRepositoryInterface $repository) { $data = $request->getAccountData(); $account = $repository->store($data); @@ -357,12 +358,12 @@ class AccountController extends Controller /** * @param AccountFormRequest $request - * @param ARI $repository + * @param AccountRepositoryInterface $repository * @param Account $account * * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ - public function update(AccountFormRequest $request, ARI $repository, Account $account) + public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account) { $data = $request->getAccountData(); $repository->update($account, $data); @@ -409,8 +410,8 @@ class AccountController extends Controller */ private function periodEntries(Account $account): Collection { - /** @var ARI $repository */ - $repository = app(ARI::class); + /** @var AccountRepositoryInterface $repository */ + $repository = app(AccountRepositoryInterface::class); /** @var AccountTaskerInterface $tasker */ $tasker = app(AccountTaskerInterface::class); diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index 916cc7c406..c6aa3c0509 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -208,7 +208,8 @@ class BillController extends Controller // use collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation() ->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 1f2d510dcb..d85670dbfe 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -202,7 +202,8 @@ class BudgetController extends Controller // collector /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget(); $journals = $collector->getPaginatedJournals(); $journals->setPath('/budgets/list/noBudget'); @@ -243,7 +244,8 @@ class BudgetController extends Controller $repetition = null; // collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); $journals->setPath('/budgets/show/' . $budget->id); @@ -280,7 +282,8 @@ class BudgetController extends Controller // collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date) ->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation(); $journals = $collector->getPaginatedJournals(); diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index e74786199c..ab8583af1a 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -157,7 +157,8 @@ class CategoryController extends Controller // new collector: /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setRange($start, $end)->withoutCategory();//->groupJournals(); $journals = $collector->getJournals(); $subTitle = trans( diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 0a8fe543cf..2c792fa908 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -416,7 +416,8 @@ class BudgetController extends Controller { // collector /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $types = [TransactionType::WITHDRAWAL]; $collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget(); $journals = $collector->getJournals(); diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php index d131f8a661..b5ab26355c 100644 --- a/app/Http/Controllers/Chart/BudgetReportController.php +++ b/app/Http/Controllers/Chart/BudgetReportController.php @@ -239,7 +239,8 @@ class BudgetReportController extends Controller private function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER]) ->setBudgets($budgets)->withOpposingAccount()->disableFilter(); $accountIds = $accounts->pluck('id')->toArray(); diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index e156becd7e..0cd50c308c 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -284,7 +284,8 @@ class CategoryReportController extends Controller private function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER]) ->setCategories($categories)->withOpposingAccount()->disableFilter(); $accountIds = $accounts->pluck('id')->toArray(); @@ -305,7 +306,8 @@ class CategoryReportController extends Controller private function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER]) ->setCategories($categories)->withOpposingAccount(); $accountIds = $accounts->pluck('id')->toArray(); diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 1ace8118c1..823c82e928 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -150,7 +150,8 @@ class ExportController extends Controller $jobs->changeStatus($job, 'export_status_make_exporter'); /** @var ProcessorInterface $processor */ - $processor = app(ProcessorInterface::class, [$settings]); + $processor = app(ProcessorInterface::class); + $processor->setSettings($settings); /* * Collect journals: diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 0f436dc962..7bd8803fa5 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -103,7 +103,8 @@ class ReportController extends Controller switch (true) { case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)): /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector ->setAccounts(new Collection([$account])) ->setRange($attributes['startDate'], $attributes['endDate']) @@ -114,7 +115,8 @@ class ReportController extends Controller case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)): $budget->name = strval(trans('firefly.no_budget')); /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector ->setAccounts(new Collection([$account])) ->setTypes($types) @@ -124,7 +126,8 @@ class ReportController extends Controller break; case ($role === BalanceLine::ROLE_DIFFROLE): /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector ->setAccounts(new Collection([$account])) ->setTypes($types) @@ -169,7 +172,8 @@ class ReportController extends Controller $repository = app(BudgetRepositoryInterface::class); $budget = $repository->find(intval($attributes['budgetId'])); /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector ->setAccounts($attributes['accounts']) @@ -203,7 +207,8 @@ class ReportController extends Controller $category = $repository->find(intval($attributes['categoryId'])); $types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER]; /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($attributes['accounts'])->setTypes($types) ->setRange($attributes['startDate'], $attributes['endDate']) ->setCategory($category); @@ -230,7 +235,8 @@ class ReportController extends Controller $account = $repository->find(intval($attributes['accountId'])); $types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER]; /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types); $journals = $collector->getJournals(); $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report @@ -266,7 +272,8 @@ class ReportController extends Controller $account = $repository->find(intval($attributes['accountId'])); $types = [TransactionType::DEPOSIT, TransactionType::TRANSFER]; /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types); $journals = $collector->getJournals(); $report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 2eee1da8a0..e20830a819 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -289,7 +289,7 @@ class RuleController extends Controller $range = config('firefly.test-triggers.range'); /** @var TransactionMatcher $matcher */ - $matcher = app('FireflyIII\Rules\TransactionMatcher'); + $matcher = app(TransactionMatcher::class); $matcher->setLimit($limit); $matcher->setRange($range); $matcher->setTriggers($triggers); @@ -352,7 +352,7 @@ class RuleController extends Controller private function createDefaultRule() { /** @var RuleRepositoryInterface $repository */ - $repository = app('FireflyIII\Repositories\Rule\RuleRepositoryInterface'); + $repository = app(RuleRepositoryInterface::class); if ($repository->count() === 0) { $data = [ diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 2ec3e8ce5c..ba38605b8f 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -72,7 +72,8 @@ class TransactionController extends Controller $end = session('end', Navigation::endOfPeriod(new Carbon, $range)); /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts(); $collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation(); @@ -122,7 +123,8 @@ class TransactionController extends Controller $subTitle = sprintf('%s (%s)', trans('firefly.title_' . $what), strtolower(trans('firefly.everything'))); $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page')); - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->withBudgetInformation()->withCategoryInformation(); // do not filter transfers if $what = transfer. @@ -161,7 +163,8 @@ class TransactionController extends Controller Log::debug(sprintf('Transaction index by date will show between %s and %s', $start->format('Y-m-d'), $end->format('Y-m-d'))); /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts(); $collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation(); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 97320a2b3f..488a3857cd 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -49,9 +49,9 @@ class Kernel extends HttpKernel */ protected $bootstrappers = [ - 'Illuminate\Foundation\Bootstrap\DetectEnvironment', + 'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', - 'FireflyIII\Bootstrap\ConfigureLogging', + //'FireflyIII\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php index fcf92d0105..b5917242d7 100644 --- a/app/Http/Requests/RuleGroupFormRequest.php +++ b/app/Http/Requests/RuleGroupFormRequest.php @@ -49,7 +49,8 @@ class RuleGroupFormRequest extends Request public function rules() { /** @var RuleGroupRepositoryInterface $repository */ - $repository = app(RuleGroupRepositoryInterface::class, [auth()->user()]); + $repository = app(RuleGroupRepositoryInterface::class); + $repository->setUser(auth()->user()); $titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title'; if (!is_null($repository->find(intval($this->get('id')))->id)) { $titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id')); diff --git a/app/Import/Converter/AccountId.php b/app/Import/Converter/AccountId.php index 5b39999f2e..4c07790fa5 100644 --- a/app/Import/Converter/AccountId.php +++ b/app/Import/Converter/AccountId.php @@ -40,7 +40,8 @@ class AccountId extends BasicConverter implements ConverterInterface return new Account; } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/AssetAccountIban.php b/app/Import/Converter/AssetAccountIban.php index 9ed749a781..d2336c282d 100644 --- a/app/Import/Converter/AssetAccountIban.php +++ b/app/Import/Converter/AssetAccountIban.php @@ -43,7 +43,8 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/AssetAccountName.php b/app/Import/Converter/AssetAccountName.php index 4785ae16d2..8618d52f2d 100644 --- a/app/Import/Converter/AssetAccountName.php +++ b/app/Import/Converter/AssetAccountName.php @@ -43,7 +43,8 @@ class AssetAccountName extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/AssetAccountNumber.php b/app/Import/Converter/AssetAccountNumber.php index 5c71bf57f1..d389492c91 100644 --- a/app/Import/Converter/AssetAccountNumber.php +++ b/app/Import/Converter/AssetAccountNumber.php @@ -41,7 +41,8 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/BillId.php b/app/Import/Converter/BillId.php index 06713afaf4..cb20e4c7c9 100644 --- a/app/Import/Converter/BillId.php +++ b/app/Import/Converter/BillId.php @@ -42,7 +42,8 @@ class BillId extends BasicConverter implements ConverterInterface } /** @var BillRepositoryInterface $repository */ - $repository = app(BillRepositoryInterface::class, [$this->user]); + $repository = app(BillRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/BillName.php b/app/Import/Converter/BillName.php index 6c4aa2fc17..3d2dbe9a71 100644 --- a/app/Import/Converter/BillName.php +++ b/app/Import/Converter/BillName.php @@ -44,7 +44,8 @@ class BillName extends BasicConverter implements ConverterInterface } /** @var BillRepositoryInterface $repository */ - $repository = app(BillRepositoryInterface::class, [$this->user]); + $repository = app(BillRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/BudgetId.php b/app/Import/Converter/BudgetId.php index 0fe769f70e..cf709c0beb 100644 --- a/app/Import/Converter/BudgetId.php +++ b/app/Import/Converter/BudgetId.php @@ -42,7 +42,8 @@ class BudgetId extends BasicConverter implements ConverterInterface } /** @var BudgetRepositoryInterface $repository */ - $repository = app(BudgetRepositoryInterface::class, [$this->user]); + $repository = app(BudgetRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/BudgetName.php b/app/Import/Converter/BudgetName.php index fc5d5416fc..7ecd85530c 100644 --- a/app/Import/Converter/BudgetName.php +++ b/app/Import/Converter/BudgetName.php @@ -42,7 +42,8 @@ class BudgetName extends BasicConverter implements ConverterInterface } /** @var BudgetRepositoryInterface $repository */ - $repository = app(BudgetRepositoryInterface::class, [$this->user]); + $repository = app(BudgetRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CategoryId.php b/app/Import/Converter/CategoryId.php index 5d538f4b90..2544a61597 100644 --- a/app/Import/Converter/CategoryId.php +++ b/app/Import/Converter/CategoryId.php @@ -42,7 +42,8 @@ class CategoryId extends BasicConverter implements ConverterInterface } /** @var CategoryRepositoryInterface $repository */ - $repository = app(CategoryRepositoryInterface::class, [$this->user]); + $repository = app(CategoryRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CategoryName.php b/app/Import/Converter/CategoryName.php index 28e7650c1f..f8af2414b1 100644 --- a/app/Import/Converter/CategoryName.php +++ b/app/Import/Converter/CategoryName.php @@ -42,7 +42,8 @@ class CategoryName extends BasicConverter implements ConverterInterface } /** @var CategoryRepositoryInterface $repository */ - $repository = app(CategoryRepositoryInterface::class, [$this->user]); + $repository = app(CategoryRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CurrencyCode.php b/app/Import/Converter/CurrencyCode.php index 48901cceaa..f78433ddf3 100644 --- a/app/Import/Converter/CurrencyCode.php +++ b/app/Import/Converter/CurrencyCode.php @@ -36,6 +36,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface /** @var CurrencyRepositoryInterface $repository */ $repository = app(CurrencyRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CurrencyId.php b/app/Import/Converter/CurrencyId.php index 6622899264..299cde1bf3 100644 --- a/app/Import/Converter/CurrencyId.php +++ b/app/Import/Converter/CurrencyId.php @@ -42,7 +42,8 @@ class CurrencyId extends BasicConverter implements ConverterInterface } /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class, [$this->user]); + $repository = app(CurrencyRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CurrencyName.php b/app/Import/Converter/CurrencyName.php index ad28107f4b..71af377582 100644 --- a/app/Import/Converter/CurrencyName.php +++ b/app/Import/Converter/CurrencyName.php @@ -42,7 +42,8 @@ class CurrencyName extends BasicConverter implements ConverterInterface } /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class, [$this->user]); + $repository = app(CurrencyRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/CurrencySymbol.php b/app/Import/Converter/CurrencySymbol.php index 307d409cd0..27ed50dd48 100644 --- a/app/Import/Converter/CurrencySymbol.php +++ b/app/Import/Converter/CurrencySymbol.php @@ -42,7 +42,8 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface } /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class, [$this->user]); + $repository = app(CurrencyRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); diff --git a/app/Import/Converter/OpposingAccountIban.php b/app/Import/Converter/OpposingAccountIban.php index c3dacbd712..ee8b40747c 100644 --- a/app/Import/Converter/OpposingAccountIban.php +++ b/app/Import/Converter/OpposingAccountIban.php @@ -43,7 +43,8 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/OpposingAccountName.php b/app/Import/Converter/OpposingAccountName.php index 4516873a25..fa51245fd6 100644 --- a/app/Import/Converter/OpposingAccountName.php +++ b/app/Import/Converter/OpposingAccountName.php @@ -42,7 +42,8 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/OpposingAccountNumber.php b/app/Import/Converter/OpposingAccountNumber.php index 86df680223..d513a88ae0 100644 --- a/app/Import/Converter/OpposingAccountNumber.php +++ b/app/Import/Converter/OpposingAccountNumber.php @@ -43,7 +43,8 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface } /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); if (isset($this->mapping[$value])) { diff --git a/app/Import/Converter/TagSplit.php b/app/Import/Converter/TagSplit.php index cc99561663..d93074b7d0 100644 --- a/app/Import/Converter/TagSplit.php +++ b/app/Import/Converter/TagSplit.php @@ -39,7 +39,8 @@ class TagSplit Log::debug('Exploded parts.', $parts); /** @var TagRepositoryInterface $repository */ - $repository = app(TagRepositoryInterface::class, [$user]); + $repository = app(TagRepositoryInterface::class); + $repository->setUser($user); /** @var string $part */ diff --git a/app/Import/ImportProcedure.php b/app/Import/ImportProcedure.php index c535d47fae..991c5addcd 100644 --- a/app/Import/ImportProcedure.php +++ b/app/Import/ImportProcedure.php @@ -58,7 +58,8 @@ class ImportProcedure implements ImportProcedureInterface if ($job->configuration['import-account'] != 0) { /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$job->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($job->user); $validator->setDefaultImportAccount($repository->find($job->configuration['import-account'])); } diff --git a/app/Import/ImportStorage.php b/app/Import/ImportStorage.php index 4edf17d5f8..12b5e33a6c 100644 --- a/app/Import/ImportStorage.php +++ b/app/Import/ImportStorage.php @@ -159,7 +159,8 @@ class ImportStorage private function createImportTag(): Tag { /** @var TagRepositoryInterface $repository */ - $repository = app(TagRepositoryInterface::class, [$this->user]); + $repository = app(TagRepositoryInterface::class); + $repository->setUser($this->user); $data = [ 'tag' => trans('firefly.import_with_key', ['key' => $this->job->key]), 'date' => new Carbon, diff --git a/app/Import/ImportValidator.php b/app/Import/ImportValidator.php index d6d15d3ed2..9a5a254151 100644 --- a/app/Import/ImportValidator.php +++ b/app/Import/ImportValidator.php @@ -177,7 +177,8 @@ class ImportValidator // find it first by new type: /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); $result = $repository->findByName($account->name, [$type]); if (is_null($result->id)) { @@ -214,7 +215,8 @@ class ImportValidator { /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); $name = 'Unknown expense account'; $result = $repository->findByName($name, [AccountType::EXPENSE]); @@ -235,7 +237,8 @@ class ImportValidator { /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [$this->user]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); $name = 'Unknown revenue account'; $result = $repository->findByName($name, [AccountType::REVENUE]); @@ -382,7 +385,8 @@ class ImportValidator { if (is_null($entry->fields['currency'])) { /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class, [$this->user]); + $repository = app(CurrencyRepositoryInterface::class); + $repository->setUser($this->user); // is the default currency for the user or the system $defaultCode = Preferences::getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data; diff --git a/app/Import/Setup/CsvSetup.php b/app/Import/Setup/CsvSetup.php index 20c938bda3..ff20d45958 100644 --- a/app/Import/Setup/CsvSetup.php +++ b/app/Import/Setup/CsvSetup.php @@ -181,7 +181,8 @@ class CsvSetup implements SetupInterface public function saveImportConfiguration(array $data, FileBag $files): bool { /** @var AccountRepositoryInterface $repository */ - $repository = app(AccountRepositoryInterface::class, [auth()->user()]); + $repository = app(AccountRepositoryInterface::class); + $repository->setUser(auth()->user()); $importId = $data['csv_import_account'] ?? 0; $account = $repository->find(intval($importId)); diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php index 1678cb2bcc..15a852414e 100644 --- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php +++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php @@ -156,7 +156,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue protected function collectJournals() { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAccounts($this->accounts)->setRange($this->startDate, $this->endDate); return $collector->getJournals(); diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index 0ce5a90329..3035731adb 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -14,7 +14,10 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Account\AccountRepository; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountTasker; +use FireflyIII\Repositories\Account\AccountTaskerInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -44,8 +47,6 @@ class AccountServiceProvider extends ServiceProvider { $this->registerRepository(); $this->registerTasker(); - - } /** @@ -54,16 +55,16 @@ class AccountServiceProvider extends ServiceProvider private function registerRepository() { $this->app->bind( - 'FireflyIII\Repositories\Account\AccountRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Account\AccountRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + AccountRepositoryInterface::class, + function (Application $app) { + /** @var AccountRepositoryInterface $repository */ + $repository = app(AccountRepository::class); + + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Account\AccountRepository', $arguments); + return $repository; } ); } @@ -74,16 +75,16 @@ class AccountServiceProvider extends ServiceProvider private function registerTasker() { $this->app->bind( - 'FireflyIII\Repositories\Account\AccountTaskerInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Account\AccountTasker', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + AccountTaskerInterface::class, + function (Application $app) { + /** @var AccountTaskerInterface $tasker */ + $tasker = app(AccountTasker::class); + + if ($app->auth->check()) { + $tasker->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Account\AccountTasker', $arguments); + return $tasker; } ); } diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index 77debb7354..c9f3a9d48d 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Attachment\AttachmentRepository; +use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,15 @@ class AttachmentServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + AttachmentRepositoryInterface::class, + function (Application $app) { + /** @var AttachmentRepositoryInterface $repository */ + $repository = app(AttachmentRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Attachment\AttachmentRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index 7275348a8d..a07e8e37ff 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Bill\BillRepository; +use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,16 @@ class BillServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Bill\BillRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Bill\BillRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + BillRepositoryInterface::class, + function (Application $app) { + /** @var BillRepositoryInterface $repository */ + $repository = app(BillRepository::class); + + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Bill\BillRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index 51408c5098..df87739ea6 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Budget\BudgetRepository; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,15 @@ class BudgetServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Budget\BudgetRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Budget\BudgetRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + BudgetRepositoryInterface::class, + function (Application $app) { + /** @var BudgetRepositoryInterface $repository */ + $repository = app(BudgetRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Budget\BudgetRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index a3deb55f30..bdac9c91f1 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Category\CategoryRepository; +use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,15 @@ class CategoryServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Category\CategoryRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Category\CategoryRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + CategoryRepositoryInterface::class, + function (Application $app) { + /** @var CategoryRepository $repository */ + $repository = app(CategoryRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Category\CategoryRepository', $arguments); + return $repository; } ); diff --git a/app/Providers/CrudServiceProvider.php b/app/Providers/CrudServiceProvider.php deleted file mode 100644 index 93acfa1412..0000000000 --- a/app/Providers/CrudServiceProvider.php +++ /dev/null @@ -1,64 +0,0 @@ -registerJournal(); - } - - private function registerJournal() - { - $this->app->bind( - 'FireflyIII\Crud\Split\JournalInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Crud\Split\Journal', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); - } - - return app('FireflyIII\Crud\Split\Journal', $arguments); - } - ); - - } -} diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index d95532e072..bfdf535c70 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Currency\CurrencyRepository; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,15 @@ class CurrencyServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Currency\CurrencyRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + CurrencyRepositoryInterface::class, + function (Application $app) { + /** @var CurrencyRepository $repository */ + $repository = app(CurrencyRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Currency\CurrencyRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/ExportJobServiceProvider.php b/app/Providers/ExportJobServiceProvider.php index 220a678623..6850f417b5 100644 --- a/app/Providers/ExportJobServiceProvider.php +++ b/app/Providers/ExportJobServiceProvider.php @@ -14,7 +14,10 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\ExportJob\ExportJobRepository; +use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface; +use FireflyIII\Repositories\ImportJob\ImportJobRepository; +use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -33,8 +36,7 @@ class ExportJobServiceProvider extends ServiceProvider */ public function boot() { - $this->exportJob(); - $this->importJob(); + } @@ -45,7 +47,8 @@ class ExportJobServiceProvider extends ServiceProvider */ public function register() { - // + $this->exportJob(); + $this->importJob(); } /** @@ -53,18 +56,16 @@ class ExportJobServiceProvider extends ServiceProvider */ private function exportJob() { - $this->app->bind( - 'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + ExportJobRepositoryInterface::class, + function (Application $app) { + /** @var ExportJobRepository $repository */ + $repository = app(ExportJobRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', $arguments); + return $repository; } ); } @@ -72,16 +73,15 @@ class ExportJobServiceProvider extends ServiceProvider private function importJob() { $this->app->bind( - 'FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + ImportJobRepositoryInterface::class, + function (Application $app) { + /** @var ImportJobRepository $repository */ + $repository = app(ImportJobRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index b798f531e0..2ef97e48d2 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -13,6 +13,28 @@ declare(strict_types = 1); namespace FireflyIII\Providers; +use FireflyIII\Export\Processor; +use FireflyIII\Export\ProcessorInterface; +use FireflyIII\Generator\Chart\Basic\ChartJsGenerator; +use FireflyIII\Generator\Chart\Basic\GeneratorInterface; +use FireflyIII\Helpers\Attachments\AttachmentHelper; +use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; +use FireflyIII\Helpers\Chart\MetaPieChart; +use FireflyIII\Helpers\Chart\MetaPieChartInterface; +use FireflyIII\Helpers\FiscalHelper; +use FireflyIII\Helpers\FiscalHelperInterface; +use FireflyIII\Helpers\Help\Help; +use FireflyIII\Helpers\Help\HelpInterface; +use FireflyIII\Helpers\Report\BalanceReportHelper; +use FireflyIII\Helpers\Report\BalanceReportHelperInterface; +use FireflyIII\Helpers\Report\BudgetReportHelper; +use FireflyIII\Helpers\Report\BudgetReportHelperInterface; +use FireflyIII\Helpers\Report\ReportHelper; +use FireflyIII\Helpers\Report\ReportHelperInterface; +use FireflyIII\Import\ImportProcedure; +use FireflyIII\Import\ImportProcedureInterface; +use FireflyIII\Repositories\User\UserRepository; +use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Amount; use FireflyIII\Support\ExpandedForm; use FireflyIII\Support\FireflyConfig; @@ -94,22 +116,22 @@ class FireflyServiceProvider extends ServiceProvider ); // chart generator: - $this->app->bind('FireflyIII\Generator\Chart\Basic\GeneratorInterface', 'FireflyIII\Generator\Chart\Basic\ChartJsGenerator'); + $this->app->bind(GeneratorInterface::class, ChartJsGenerator::class); // chart builder - $this->app->bind('FireflyIII\Helpers\Chart\MetaPieChartInterface', 'FireflyIII\Helpers\Chart\MetaPieChart'); + $this->app->bind(MetaPieChartInterface::class, MetaPieChart::class); // other generators - $this->app->bind('FireflyIII\Export\ProcessorInterface', 'FireflyIII\Export\Processor'); - $this->app->bind('FireflyIII\Import\ImportProcedureInterface', 'FireflyIII\Import\ImportProcedure'); - $this->app->bind('FireflyIII\Repositories\User\UserRepositoryInterface', 'FireflyIII\Repositories\User\UserRepository'); - $this->app->bind('FireflyIII\Helpers\Attachments\AttachmentHelperInterface', 'FireflyIII\Helpers\Attachments\AttachmentHelper'); + $this->app->bind(ProcessorInterface::class,Processor::class); + $this->app->bind(ImportProcedureInterface::class,ImportProcedure::class); + $this->app->bind(UserRepositoryInterface::class, UserRepository::class); + $this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class); - $this->app->bind('FireflyIII\Helpers\Help\HelpInterface', 'FireflyIII\Helpers\Help\Help'); - $this->app->bind('FireflyIII\Helpers\Report\ReportHelperInterface', 'FireflyIII\Helpers\Report\ReportHelper'); - $this->app->bind('FireflyIII\Helpers\FiscalHelperInterface', 'FireflyIII\Helpers\FiscalHelper'); - $this->app->bind('FireflyIII\Helpers\Report\BalanceReportHelperInterface', 'FireflyIII\Helpers\Report\BalanceReportHelper'); - $this->app->bind('FireflyIII\Helpers\Report\BudgetReportHelperInterface', 'FireflyIII\Helpers\Report\BudgetReportHelper'); + $this->app->bind(HelpInterface::class, Help::class); + $this->app->bind(ReportHelperInterface::class, ReportHelper::class); + $this->app->bind(FiscalHelperInterface::class,FiscalHelper::class); + $this->app->bind(BalanceReportHelperInterface::class, BalanceReportHelper::class); + $this->app->bind(BudgetReportHelperInterface::class, BudgetReportHelper::class); } } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 2ac7f61f64..b44c11b760 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -14,7 +14,12 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Helpers\Collector\JournalCollector; +use FireflyIII\Helpers\Collector\JournalCollectorInterface; +use FireflyIII\Repositories\Journal\JournalRepository; +use FireflyIII\Repositories\Journal\JournalRepositoryInterface; +use FireflyIII\Repositories\Journal\JournalTasker; +use FireflyIII\Repositories\Journal\JournalTaskerInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -50,16 +55,16 @@ class JournalServiceProvider extends ServiceProvider private function registerCollector() { $this->app->bind( - 'FireflyIII\Helpers\Collector\JournalCollectorInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Helpers\Collector\JournalCollector', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + JournalCollectorInterface::class, + function (Application $app) { + /** @var JournalCollectorInterface $collector */ + $collector = app(JournalCollector::class); + if ($app->auth->check()) { + $collector->setUser(auth()->user()); } + $collector->startQuery(); - return app('FireflyIII\Helpers\Collector\JournalCollector', $arguments); + return $collector; } ); } @@ -67,16 +72,16 @@ class JournalServiceProvider extends ServiceProvider private function registerRepository() { $this->app->bind( - 'FireflyIII\Repositories\Journal\JournalRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Journal\JournalRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + JournalRepositoryInterface::class, + function (Application $app) { + /** @var JournalRepositoryInterface $repository */ + $repository = app(JournalRepository::class); + if ($app->auth->check()) { + + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Journal\JournalRepository', $arguments); + return $repository; } ); } @@ -84,16 +89,16 @@ class JournalServiceProvider extends ServiceProvider private function registerTasker() { $this->app->bind( - 'FireflyIII\Repositories\Journal\JournalTaskerInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Journal\JournalTasker', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + JournalTaskerInterface::class, + function (Application $app) { + /** @var JournalTaskerInterface $tasker */ + $tasker = app(JournalTasker::class); + + if ($app->auth->check()) { + $tasker->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Journal\JournalTasker', $arguments); + return $tasker; } ); } diff --git a/app/Providers/LogServiceProvider.php b/app/Providers/LogServiceProvider.php new file mode 100644 index 0000000000..86bf30481f --- /dev/null +++ b/app/Providers/LogServiceProvider.php @@ -0,0 +1,53 @@ +useDailyFiles( + $this->app->storagePath() . '/logs/firefly-iii.log', $this->maxFiles(), + $this->logLevel() + ); + } + + /** + * Configure the Monolog handlers for the application. + * + * @param \Illuminate\Log\Writer $log + * + * @return void + */ + protected function configureSingleHandler(Writer $log) + { + $log->useFiles( + $this->app->storagePath() . '/logs/firefly-iii.log', + $this->logLevel() + ); + } +} \ No newline at end of file diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index 11ba540e3c..fb1aaf7d5f 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -15,6 +15,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\PiggyBank\PiggyBankRepository; +use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -44,16 +46,14 @@ class PiggyBankServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [auth()->user()]); + PiggyBankRepositoryInterface::class, + function (Application $app) { + /** @var PiggyBankRepository $repository */ + $repository = app(PiggyBankRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); - } - - return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index bddd6a8480..0a3c8db599 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\RuleGroup\RuleGroupRepository; +use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -44,16 +45,15 @@ class RuleGroupServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + RuleGroupRepositoryInterface::class, + function (Application $app) { + /** @var RuleGroupRepository $repository */ + $repository = app(RuleGroupRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index a395e8cda3..5d694411b3 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Rule\RuleRepository; +use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,14 @@ class RuleServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Rule\RuleRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Rule\RuleRepository', [auth()->user()]); + RuleRepositoryInterface::class, + function (Application $app) { + /** @var RuleRepository $repository */ + $repository = app(RuleRepository::class); + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); - } - - return app('FireflyIII\Repositories\Rule\RuleRepository', $arguments); + return $repository; } ); } diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index a7be767e5e..18d5b48c6e 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Support\Search\Search; +use FireflyIII\Support\Search\SearchInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,15 @@ class SearchServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Support\Search\SearchInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Support\Search\Search', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + SearchInterface::class, + function (Application $app) { + /** @var Search $search */ + $search = app(Search::class); + if ($app->auth->check()) { + $search->setUser(auth()->user()); } - return app('FireflyIII\Support\Search\Search', $arguments); + return $search; } ); } diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index 8889c9fbeb..b5daa36c6c 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -14,7 +14,8 @@ declare(strict_types = 1); namespace FireflyIII\Providers; -use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Repositories\Tag\TagRepository; +use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -43,16 +44,16 @@ class TagServiceProvider extends ServiceProvider public function register() { $this->app->bind( - 'FireflyIII\Repositories\Tag\TagRepositoryInterface', - function (Application $app, array $arguments) { - if (!isset($arguments[0]) && $app->auth->check()) { - return app('FireflyIII\Repositories\Tag\TagRepository', [auth()->user()]); - } - if (!isset($arguments[0]) && !$app->auth->check()) { - throw new FireflyException('There is no user present.'); + TagRepositoryInterface::class, + function (Application $app) { + /** @var TagRepository $repository */ + $repository = app(TagRepository::class); + + if ($app->auth->check()) { + $repository->setUser(auth()->user()); } - return app('FireflyIII\Repositories\Tag\TagRepository', $arguments); + return $repository; } ); } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index d740291f68..26ba26b6ea 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -43,16 +43,6 @@ class AccountRepository implements AccountRepositoryInterface /** @var array */ private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC']; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * Moved here from account CRUD * @@ -323,6 +313,14 @@ class AccountRepository implements AccountRepositoryInterface return $journal->date; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 428e48144d..b0ab9b738b 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Account; use Carbon\Carbon; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionJournal; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -124,6 +125,11 @@ interface AccountRepositoryInterface */ public function oldestJournalDate(Account $account): Carbon; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 126d084e8d..d43902e094 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -31,16 +31,6 @@ class AccountTasker implements AccountTaskerInterface /** @var User */ private $user; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @see self::amountInPeriod * @@ -108,8 +98,8 @@ class AccountTasker implements AccountTaskerInterface */ public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array { - $ids = $accounts->pluck('id')->toArray(); - $yesterday = clone $start; + $ids = $accounts->pluck('id')->toArray(); + $yesterday = clone $start; $yesterday->subDay(); $startSet = Steam::balancesById($ids, $yesterday); $endSet = Steam::balancesById($ids, $end); @@ -155,6 +145,14 @@ class AccountTasker implements AccountTaskerInterface return $return; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * Will return how much money has been going out (ie. spent) by the given account(s). * Alternatively, will return how much money has been coming in (ie. earned) by the given accounts. diff --git a/app/Repositories/Account/AccountTaskerInterface.php b/app/Repositories/Account/AccountTaskerInterface.php index 57fbebaa79..4ea5be74ef 100644 --- a/app/Repositories/Account/AccountTaskerInterface.php +++ b/app/Repositories/Account/AccountTaskerInterface.php @@ -14,6 +14,7 @@ declare(strict_types = 1); namespace FireflyIII\Repositories\Account; use Carbon\Carbon; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -23,7 +24,6 @@ use Illuminate\Support\Collection; */ interface AccountTaskerInterface { - /** * @param Collection $accounts * @param Collection $excluded @@ -57,4 +57,9 @@ interface AccountTaskerInterface */ public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array; + /** + * @param User $user + */ + public function setUser(User $user); + } diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 1bc9401624..79a481e4ab 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -14,12 +14,12 @@ declare(strict_types = 1); namespace FireflyIII\Repositories\Attachment; use Carbon\Carbon; +use Crypt; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Models\Attachment; use FireflyIII\User; use Illuminate\Support\Collection; use Storage; -use Crypt; /** * Class AttachmentRepository @@ -31,16 +31,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface /** @var User */ private $user; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param Attachment $attachment * @@ -117,6 +107,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface return ''; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Attachment $attachment * @param array $data diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index 9e12092c70..cc7cb887f8 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Attachment; use Carbon\Carbon; use FireflyIII\Models\Attachment; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -59,6 +60,11 @@ interface AttachmentRepositoryInterface */ public function getContent(Attachment $attachment): string; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Attachment $attachment * @param array $attachmentData diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index d3bfa01572..545a29fb96 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -37,16 +37,6 @@ class BillRepository implements BillRepositoryInterface /** @var User */ private $user; - /** - * BillRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param Bill $bill * @@ -520,6 +510,14 @@ class BillRepository implements BillRepositoryInterface } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index c2c6cd223d..2e07d12d93 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; use FireflyIII\Models\Bill; use FireflyIII\Models\TransactionJournal; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -25,7 +26,6 @@ use Illuminate\Support\Collection; */ interface BillRepositoryInterface { - /** * @param Bill $bill * @@ -159,6 +159,11 @@ interface BillRepositoryInterface */ public function scan(Bill $bill, TransactionJournal $journal): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 7c8d2f6391..9b4f985390 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -38,16 +38,6 @@ class BudgetRepository implements BudgetRepositoryInterface /** @var User */ private $user; - /** - * BudgetRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @return bool */ @@ -433,6 +423,14 @@ class BudgetRepository implements BudgetRepositoryInterface return true; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Collection $budgets * @param Collection $accounts @@ -444,7 +442,8 @@ class BudgetRepository implements BudgetRepositoryInterface public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setBudgets($budgets); if ($accounts->count() > 0) { @@ -470,7 +469,8 @@ class BudgetRepository implements BudgetRepositoryInterface public function spentInPeriodWoBudget(Collection $accounts, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutBudget(); if ($accounts->count() > 0) { diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index ee9eba1641..906a4827ae 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -17,6 +17,7 @@ use Carbon\Carbon; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -26,7 +27,6 @@ use Illuminate\Support\Collection; */ interface BudgetRepositoryInterface { - /** * @return bool */ @@ -149,6 +149,11 @@ interface BudgetRepositoryInterface */ public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Collection $budgets * @param Collection $accounts diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 32c2eb2135..bed2d5847f 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -34,16 +34,6 @@ class CategoryRepository implements CategoryRepositoryInterface /** @var User */ private $user; - /** - * CategoryRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param Category $category * @@ -67,7 +57,8 @@ class CategoryRepository implements CategoryRepositoryInterface public function earnedInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($accounts)->setCategories($categories); $set = $collector->getJournals(); $sum = strval($set->sum('transaction_amount')); @@ -384,6 +375,14 @@ class CategoryRepository implements CategoryRepositoryInterface return $result; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param Collection $categories * @param Collection $accounts @@ -395,7 +394,8 @@ class CategoryRepository implements CategoryRepositoryInterface public function spentInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setCategories($categories); @@ -423,7 +423,8 @@ class CategoryRepository implements CategoryRepositoryInterface public function spentInPeriodWithoutCategory(Collection $accounts, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutCategory(); if ($accounts->count() > 0) { diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 1194fbbf74..9e89a78f50 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Category; use Carbon\Carbon; use FireflyIII\Models\Category; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -121,6 +122,11 @@ interface CategoryRepositoryInterface */ public function periodIncomeNoCategory(Collection $accounts, Carbon $start, Carbon $end): array; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Collection $categories * @param Collection $accounts diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index d2eaed1c30..bb1444d73c 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -31,11 +31,9 @@ class CurrencyRepository implements CurrencyRepositoryInterface private $user; /** - * CategoryRepository constructor. - * * @param User $user */ - public function __construct(User $user) + public function setUser(User $user) { $this->user = $user; } diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 4ccebe40b0..63eb9bf0b5 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Currency; use FireflyIII\Models\Preference; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -94,6 +95,11 @@ interface CurrencyRepositoryInterface */ public function getCurrencyByPreference(Preference $preference): TransactionCurrency; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.php index b83818284a..aa956f901e 100644 --- a/app/Repositories/ExportJob/ExportJobRepository.php +++ b/app/Repositories/ExportJob/ExportJobRepository.php @@ -29,16 +29,6 @@ class ExportJobRepository implements ExportJobRepositoryInterface /** @var User */ private $user; - /** - * ExportJobRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param ExportJob $job * @param string $status @@ -149,4 +139,12 @@ class ExportJobRepository implements ExportJobRepositoryInterface return $content; } + + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } } diff --git a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php index 6f3c7a30b1..7e93663ea5 100644 --- a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php +++ b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php @@ -14,6 +14,7 @@ declare(strict_types = 1); namespace FireflyIII\Repositories\ExportJob; use FireflyIII\Models\ExportJob; +use FireflyIII\User; /** * Interface ExportJobRepositoryInterface @@ -61,4 +62,9 @@ interface ExportJobRepositoryInterface */ public function getContent(ExportJob $job): string; + /** + * @param User $user + */ + public function setUser(User $user); + } diff --git a/app/Repositories/ImportJob/ImportJobRepository.php b/app/Repositories/ImportJob/ImportJobRepository.php index d7f4ac30cf..0eec759e5b 100644 --- a/app/Repositories/ImportJob/ImportJobRepository.php +++ b/app/Repositories/ImportJob/ImportJobRepository.php @@ -28,16 +28,6 @@ class ImportJobRepository implements ImportJobRepositoryInterface /** @var User */ private $user; - /** - * ExportJobRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param string $fileType * @@ -95,4 +85,12 @@ class ImportJobRepository implements ImportJobRepositoryInterface return $result; } + + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } } diff --git a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php index a17d9ca62c..5bb2149fbe 100644 --- a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php +++ b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php @@ -14,6 +14,7 @@ declare(strict_types = 1); namespace FireflyIII\Repositories\ImportJob; use FireflyIII\Models\ImportJob; +use FireflyIII\User; /** * Interface ImportJobRepositoryInterface @@ -35,4 +36,9 @@ interface ImportJobRepositoryInterface * @return ImportJob */ public function findByKey(string $key): ImportJob; + + /** + * @param User $user + */ + public function setUser(User $user); } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 9ee336cddf..12ce898ff1 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -44,11 +44,9 @@ class JournalRepository implements JournalRepositoryInterface private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes']; /** - * JournalRepository constructor. - * * @param User $user */ - public function __construct(User $user) + public function setUser(User $user) { $this->user = $user; } diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 0b62a5729a..f1f5438ad4 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Journal; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; +use FireflyIII\User; use Illuminate\Support\Collection; use Illuminate\Support\MessageBag; @@ -26,7 +27,6 @@ use Illuminate\Support\MessageBag; */ interface JournalRepositoryInterface { - /** * @param TransactionJournal $journal * @param TransactionType $type @@ -37,11 +37,6 @@ interface JournalRepositoryInterface */ public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag; - /** - * @return Collection - */ - public function getTransactionTypes(): Collection; - /** * Deletes a journal. * @@ -67,6 +62,15 @@ interface JournalRepositoryInterface */ public function first(): TransactionJournal; + /** + * @return Collection + */ + public function getTransactionTypes(): Collection; + + /** + * @param User $user + */ + public function setUser(User $user); /** * @param array $data diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php index eb77c77e6f..c0424242c8 100644 --- a/app/Repositories/Journal/JournalTasker.php +++ b/app/Repositories/Journal/JournalTasker.php @@ -35,15 +35,6 @@ class JournalTasker implements JournalTaskerInterface /** @var User */ private $user; - /** - * JournalRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } /** * @param TransactionJournal $journal @@ -152,6 +143,14 @@ class JournalTasker implements JournalTaskerInterface return $transactions; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * Collect the balance of an account before the given transaction has hit. This is tricky, because * the balance does not depend on the transaction itself but the journal it's part of. And of course diff --git a/app/Repositories/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.php index 058bc63733..1273f69c3a 100644 --- a/app/Repositories/Journal/JournalTaskerInterface.php +++ b/app/Repositories/Journal/JournalTaskerInterface.php @@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Journal; use FireflyIII\Models\TransactionJournal; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -24,7 +25,6 @@ use Illuminate\Support\Collection; */ interface JournalTaskerInterface { - /** * @param TransactionJournal $journal * @@ -41,4 +41,9 @@ interface JournalTaskerInterface * @return array */ public function getTransactionsOverview(TransactionJournal $journal): array; + + /** + * @param User $user + */ + public function setUser(User $user); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 5a9f07704c..1f14467a5b 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -32,16 +32,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface /** @var User */ private $user; - /** - * PiggyBankRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @param PiggyBank $piggyBank * @param string $amount @@ -167,6 +157,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface return true; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index aae01702d7..a2da326d86 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\PiggyBank; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankEvent; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -98,6 +99,10 @@ interface PiggyBankRepositoryInterface */ public function setOrder(int $piggyBankId, int $order): bool; + /** + * @param User $user + */ + public function setUser(User $user); /** * Store new piggy bank. diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 4b7ce00433..7e0487be63 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -30,16 +30,6 @@ class RuleRepository implements RuleRepositoryInterface /** @var User */ private $user; - /** - * BillRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * @return int */ @@ -218,6 +208,14 @@ class RuleRepository implements RuleRepositoryInterface } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param array $data * diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index 518417d94a..6ca1456214 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -17,6 +17,7 @@ use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleTrigger; +use FireflyIII\User; /** * Interface RuleRepositoryInterface @@ -25,7 +26,6 @@ use FireflyIII\Models\RuleTrigger; */ interface RuleRepositoryInterface { - /** * @return int */ @@ -94,6 +94,11 @@ interface RuleRepositoryInterface */ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index b294e19937..e413987334 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -31,11 +31,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface private $user; /** - * BillRepository constructor. - * * @param User $user */ - public function __construct(User $user) + public function setUser(User $user) { $this->user = $user; } diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php index 985a121b92..c365fca704 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php +++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php @@ -26,7 +26,6 @@ use Illuminate\Support\Collection; interface RuleGroupRepositoryInterface { - /** * * @@ -92,6 +91,11 @@ interface RuleGroupRepositoryInterface */ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $data * diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 8145be1151..9f91816252 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -35,11 +35,9 @@ class TagRepository implements TagRepositoryInterface private $user; /** - * TagRepository constructor. - * * @param User $user */ - public function __construct(User $user) + public function setUser(User $user) { $this->user = $user; } @@ -396,7 +394,8 @@ class TagRepository implements TagRepositoryInterface public function earnedInPeriod(Tag $tag, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAllAssetAccounts()->setTag($tag); $set = $collector->getJournals(); $sum = strval($set->sum('transaction_amount')); @@ -414,7 +413,8 @@ class TagRepository implements TagRepositoryInterface public function spentInPeriod(Tag $tag, Carbon $start, Carbon $end): string { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAllAssetAccounts()->setTag($tag); $set = $collector->getJournals(); $sum = strval($set->sum('transaction_amount')); diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index 64bf47c44e..b360e7d436 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; use FireflyIII\Models\Tag; use FireflyIII\Models\TransactionJournal; +use FireflyIII\User; use Illuminate\Support\Collection; @@ -89,6 +90,11 @@ interface TagRepositoryInterface */ public function lastUseDate(Tag $tag): Carbon; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param Tag $tag * @param Carbon $start diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index 93e34a7a14..9e2bb096b3 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -24,6 +24,7 @@ use Illuminate\Support\Collection; */ interface UserRepositoryInterface { + /** * Returns a collection of all users. * diff --git a/app/Rules/Actions/SetBudget.php b/app/Rules/Actions/SetBudget.php index 90d7aa6d18..e9f8c1fae9 100644 --- a/app/Rules/Actions/SetBudget.php +++ b/app/Rules/Actions/SetBudget.php @@ -50,7 +50,8 @@ class SetBudget implements ActionInterface public function act(TransactionJournal $journal): bool { /** @var BudgetRepositoryInterface $repository */ - $repository = app(BudgetRepositoryInterface::class, [$journal->user]); + $repository = app(BudgetRepositoryInterface::class); + $repository->setUser($journal->user); $search = $this->action->action_value; $budgets = $repository->getActiveBudgets(); $budget = $budgets->filter( diff --git a/app/Rules/Actions/SetDestinationAccount.php b/app/Rules/Actions/SetDestinationAccount.php index 829c4928c4..25677e546b 100644 --- a/app/Rules/Actions/SetDestinationAccount.php +++ b/app/Rules/Actions/SetDestinationAccount.php @@ -60,7 +60,8 @@ class SetDestinationAccount implements ActionInterface public function act(TransactionJournal $journal): bool { $this->journal = $journal; - $this->repository = app(AccountRepositoryInterface::class, [$journal->user]); + $this->repository = app(AccountRepositoryInterface::class); + $this->repository->setUser($journal->user); $count = $journal->transactions()->count(); if ($count > 2) { Log::error(sprintf('Cannot change destination account of journal #%d because it is a split journal.', $journal->id)); diff --git a/app/Rules/Actions/SetSourceAccount.php b/app/Rules/Actions/SetSourceAccount.php index 5e625fe886..fc8067856c 100644 --- a/app/Rules/Actions/SetSourceAccount.php +++ b/app/Rules/Actions/SetSourceAccount.php @@ -60,7 +60,8 @@ class SetSourceAccount implements ActionInterface public function act(TransactionJournal $journal): bool { $this->journal = $journal; - $this->repository = app(AccountRepositoryInterface::class, [$journal->user]); + $this->repository = app(AccountRepositoryInterface::class); + $this->repository->setUser($journal->user); $count = $journal->transactions()->count(); if ($count > 2) { Log::error(sprintf('Cannot change source account of journal #%d because it is a split journal.', $journal->id)); diff --git a/app/Rules/TransactionMatcher.php b/app/Rules/TransactionMatcher.php index acac7c8521..5241e4f84c 100644 --- a/app/Rules/TransactionMatcher.php +++ b/app/Rules/TransactionMatcher.php @@ -78,7 +78,8 @@ class TransactionMatcher do { // Fetch a batch of transactions from the database /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [auth()->user()]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser(auth()->user()); $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)->setTypes($this->transactionTypes); $set = $collector->getPaginatedJournals(); Log::debug(sprintf('Found %d journals to check. ', $set->count())); diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php index c71e1e2985..b37af85daa 100644 --- a/app/Support/Search/Search.php +++ b/app/Support/Search/Search.php @@ -37,16 +37,6 @@ class Search implements SearchInterface /** @var User */ private $user; - /** - * AttachmentRepository constructor. - * - * @param User $user - */ - public function __construct(User $user) - { - $this->user = $user; - } - /** * The search will assume that the user does not have so many accounts * that this search should be paginated. @@ -164,7 +154,8 @@ class Search implements SearchInterface $result = new Collection(); do { /** @var JournalCollectorInterface $collector */ - $collector = app(JournalCollectorInterface::class, [$this->user]); + $collector = app(JournalCollectorInterface::class); + $collector->setUser($this->user); $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page); $set = $collector->getPaginatedJournals(); Log::debug(sprintf('Found %d journals to check. ', $set->count())); @@ -222,6 +213,14 @@ class Search implements SearchInterface $this->limit = $limit; } + /** + * @param User $user + */ + public function setUser(User $user) + { + $this->user = $user; + } + /** * @param string $haystack * @param array $needle @@ -241,4 +240,4 @@ class Search implements SearchInterface return false; } -} +} diff --git a/app/Support/Search/SearchInterface.php b/app/Support/Search/SearchInterface.php index bd16c78853..ed9c3c6c88 100644 --- a/app/Support/Search/SearchInterface.php +++ b/app/Support/Search/SearchInterface.php @@ -13,6 +13,7 @@ declare(strict_types = 1); namespace FireflyIII\Support\Search; +use FireflyIII\User; use Illuminate\Support\Collection; /** @@ -29,6 +30,11 @@ interface SearchInterface */ public function searchAccounts(array $words): Collection; + /** + * @param User $user + */ + public function setUser(User $user); + /** * @param array $words * diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 61590816b4..f38a164993 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -27,9 +27,9 @@ use FireflyIII\Rules\Triggers\TriggerInterface; use FireflyIII\User; use Google2FA; use Illuminate\Contracts\Encryption\DecryptException; +use Illuminate\Contracts\Translation\Translator; use Illuminate\Validation\Validator; use Session; -use Symfony\Component\Translation\TranslatorInterface; /** * Class FireflyValidator @@ -40,14 +40,14 @@ class FireflyValidator extends Validator { /** - * @param TranslatorInterface $translator - * @param array $data - * @param array $rules - * @param array $messages - * @param array $customAttributes + * @param Translator $translator + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes * */ - public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) + public function __construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) { parent::__construct($translator, $data, $rules, $messages, $customAttributes); } @@ -158,6 +158,7 @@ class FireflyValidator extends Validator public function validateMore($attribute, $value, $parameters): bool { $compare = $parameters[0] ?? '0'; + return bccomp($value, $compare) > 0; } diff --git a/composer.json b/composer.json index 76c2816122..8e493a3031 100755 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "financials", "financial", "budgets", - "administration", + "administration", "tool", "tooling", "help", @@ -48,15 +48,15 @@ "require": { "php": ">=7.0.0", "ext-intl": "*", - "ext-bcmath": "*", - "laravel/framework": "5.3.29", - "davejamesmiller/laravel-breadcrumbs": "^3.0", + "laravel/framework": "5.4.*", + "davejamesmiller/laravel-breadcrumbs": "3.1", "watson/validating": "3.*", "doctrine/dbal": "^2.5", "league/commonmark": "0.15.*", + "twig/twig": "1.30.0", "rcrowe/twigbridge": "0.9.*", "league/csv": "8.*", - "laravelcollective/html": "^5.3", + "laravelcollective/html": "^5.4", "rmccue/requests": "1.*", "pragmarx/google2fa": "1.*", "bacon/bacon-qr-code": "1.*" @@ -79,9 +79,9 @@ } }, "autoload-dev": { - "classmap": [ - "tests/TestCase.php" - ] + "psr-4": { + "Tests\\": "tests/" + } }, "scripts": { "post-root-package-install": [ @@ -105,5 +105,11 @@ }, "config": { "preferred-install": "dist" - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/firefly-iii/laravel-breadcrumbs.git" + } + ] } diff --git a/composer.lock b/composer.lock index 0792641fa5..1c8211b043 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "098af9634cba1c6d47c25ef1d4803367", + "content-hash": "bccf2c2fdac584664dd6c952f1d91ba8", "packages": [ { "name": "bacon/bacon-qr-code", @@ -102,72 +102,18 @@ ], "time": "2016-05-05T11:49:03+00:00" }, - { - "name": "classpreloader/classpreloader", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/ClassPreloader/ClassPreloader.git", - "reference": "bc7206aa892b5a33f4680421b69b191efd32b096" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/bc7206aa892b5a33f4680421b69b191efd32b096", - "reference": "bc7206aa892b5a33f4680421b69b191efd32b096", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^1.0|^2.0|^3.0", - "php": ">=5.5.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.8|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "ClassPreloader\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com" - } - ], - "description": "Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case", - "keywords": [ - "autoload", - "class", - "preload" - ], - "time": "2016-09-16T12:50:15+00:00" - }, { "name": "davejamesmiller/laravel-breadcrumbs", - "version": "3.0.2", + "version": "3.1", "source": { "type": "git", - "url": "https://github.com/davejamesmiller/laravel-breadcrumbs.git", - "reference": "6ca5a600003ecb52a5b5af14dad82033058604e1" + "url": "https://github.com/firefly-iii/laravel-breadcrumbs.git", + "reference": "afebafc321432188b10dafc7b4c072501687f3d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/zipball/6ca5a600003ecb52a5b5af14dad82033058604e1", - "reference": "6ca5a600003ecb52a5b5af14dad82033058604e1", + "url": "https://api.github.com/repos/firefly-iii/laravel-breadcrumbs/zipball/afebafc321432188b10dafc7b4c072501687f3d0", + "reference": "afebafc321432188b10dafc7b4c072501687f3d0", "shasum": "" }, "require": { @@ -187,7 +133,6 @@ "DaveJamesMiller\\Breadcrumbs\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT License" ], @@ -203,40 +148,10 @@ "keywords": [ "laravel" ], - "time": "2017-01-30T21:16:53+00:00" - }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" + "support": { + "source": "https://github.com/firefly-iii/laravel-breadcrumbs/tree/3.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "@stable" - }, - "type": "project", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "time": "2014-10-24T07:27:01+00:00" + "time": "2017-01-30T07:52:50+00:00" }, { "name": "doctrine/annotations", @@ -709,77 +624,26 @@ "time": "2014-09-09T13:34:57+00:00" }, { - "name": "jakub-onderka/php-console-color", - "version": "0.1", + "name": "erusev/parsedown", + "version": "1.6.1", "source": { "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + "url": "https://github.com/erusev/parsedown.git", + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/20ff8bbb57205368b4b42d094642a3e52dac85fb", + "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb", "shasum": "" }, "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" - } - ], - "time": "2014-04-08T15:00:19+00:00" - }, - { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.3.2", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "shasum": "" - }, - "require": { - "jakub-onderka/php-console-color": "~0.1", "php": ">=5.3.0" }, - "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.5", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" - }, "type": "library", "autoload": { "psr-0": { - "JakubOnderka\\PhpConsoleHighlighter": "src/" + "Parsedown": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -788,109 +652,55 @@ ], "authors": [ { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" } ], - "time": "2015-04-20T18:58:01+00:00" - }, - { - "name": "jeremeamia/SuperClosure", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/jeremeamia/super_closure.git", - "reference": "443c3df3207f176a1b41576ee2a66968a507b3db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/443c3df3207f176a1b41576ee2a66968a507b3db", - "reference": "443c3df3207f176a1b41576ee2a66968a507b3db", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^1.2|^2.0|^3.0", - "php": ">=5.4", - "symfony/polyfill-php56": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "SuperClosure\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia", - "role": "Developer" - } - ], - "description": "Serialize Closure objects, including their context and binding", - "homepage": "https://github.com/jeremeamia/super_closure", + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", "keywords": [ - "closure", - "function", - "lambda", - "parser", - "serializable", - "serialize", - "tokenizer" + "markdown", + "parser" ], - "time": "2016-12-07T09:37:55+00:00" + "time": "2016-11-02T15:56:58+00:00" }, { "name": "laravel/framework", - "version": "v5.3.29", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "6fd76dec90466dc3f703d8df72e38130f2ee6a32" + "reference": "600330ae1d218919b3b307e0578461a2df248663" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/6fd76dec90466dc3f703d8df72e38130f2ee6a32", - "reference": "6fd76dec90466dc3f703d8df72e38130f2ee6a32", + "url": "https://api.github.com/repos/laravel/framework/zipball/600330ae1d218919b3b307e0578461a2df248663", + "reference": "600330ae1d218919b3b307e0578461a2df248663", "shasum": "" }, "require": { - "classpreloader/classpreloader": "~3.0", "doctrine/inflector": "~1.0", + "erusev/parsedown": "~1.6", "ext-mbstring": "*", "ext-openssl": "*", - "jeremeamia/superclosure": "~2.2", "league/flysystem": "~1.0", "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", "nesbot/carbon": "~1.20", "paragonie/random_compat": "~1.4|~2.0", "php": ">=5.6.4", - "psy/psysh": "0.7.*|0.8.*", "ramsey/uuid": "~3.0", "swiftmailer/swiftmailer": "~5.4", - "symfony/console": "3.1.*", - "symfony/debug": "3.1.*", - "symfony/finder": "3.1.*", - "symfony/http-foundation": "3.1.*", - "symfony/http-kernel": "3.1.*", - "symfony/process": "3.1.*", - "symfony/routing": "3.1.*", - "symfony/translation": "3.1.*", - "symfony/var-dumper": "3.1.*", + "symfony/console": "~3.2", + "symfony/debug": "~3.2", + "symfony/finder": "~3.2", + "symfony/http-foundation": "~3.2", + "symfony/http-kernel": "~3.2", + "symfony/process": "~3.2", + "symfony/routing": "~3.2", + "symfony/var-dumper": "~3.2", + "tijsverkoyen/css-to-inline-styles": "~2.2", "vlucas/phpdotenv": "~2.2" }, "replace": { @@ -927,31 +737,34 @@ }, "require-dev": { "aws/aws-sdk-php": "~3.0", + "doctrine/dbal": "~2.5", "mockery/mockery": "~0.9.4", "pda/pheanstalk": "~3.0", - "phpunit/phpunit": "~5.4", + "phpunit/phpunit": "~5.7", "predis/predis": "~1.0", - "symfony/css-selector": "3.1.*", - "symfony/dom-crawler": "3.1.*" + "symfony/css-selector": "~3.2", + "symfony/dom-crawler": "~3.2" }, "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).", "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~5.3|~6.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).", + "laravel/tinker": "Required to use the tinker console command (~1.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", + "nexmo/client": "Required to use the Nexmo transport (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", - "symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).", - "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).", - "symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)." + "symfony/css-selector": "Required to use some of the crawler integration testing tools (~3.2).", + "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (~3.2).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3-dev" + "dev-master": "5.4-dev" } }, "autoload": { @@ -979,32 +792,32 @@ "framework", "laravel" ], - "time": "2017-01-06T14:33:56+00:00" + "time": "2017-02-03T19:47:35+00:00" }, { "name": "laravelcollective/html", - "version": "v5.3.1", + "version": "v5.4.1", "source": { "type": "git", "url": "https://github.com/LaravelCollective/html.git", - "reference": "2f7f2e127c6fed47f269ea29ab5efeb8f65e9d35" + "reference": "7570f25d58a00fd6909c0563808590f9cdb14d47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/2f7f2e127c6fed47f269ea29ab5efeb8f65e9d35", - "reference": "2f7f2e127c6fed47f269ea29ab5efeb8f65e9d35", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/7570f25d58a00fd6909c0563808590f9cdb14d47", + "reference": "7570f25d58a00fd6909c0563808590f9cdb14d47", "shasum": "" }, "require": { - "illuminate/http": "5.3.*", - "illuminate/routing": "5.3.*", - "illuminate/session": "5.3.*", - "illuminate/support": "5.3.*", - "illuminate/view": "5.3.*", + "illuminate/http": "5.4.*", + "illuminate/routing": "5.4.*", + "illuminate/session": "5.4.*", + "illuminate/support": "5.4.*", + "illuminate/view": "5.4.*", "php": ">=5.6.4" }, "require-dev": { - "illuminate/database": "5.3.*", + "illuminate/database": "5.4.*", "mockery/mockery": "~0.9.4", "phpunit/phpunit": "~5.4" }, @@ -1033,7 +846,7 @@ ], "description": "HTML and Form Builders for the Laravel Framework", "homepage": "http://laravelcollective.com", - "time": "2016-12-13T14:23:36+00:00" + "time": "2017-01-26T19:27:05+00:00" }, { "name": "league/commonmark", @@ -1419,57 +1232,6 @@ ], "time": "2017-01-16T07:55:07+00:00" }, - { - "name": "nikic/php-parser", - "version": "v3.0.3", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5b8182cc0abb4b0ff290ba9df6c0e1323286013a", - "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2017-02-03T21:57:31+00:00" - }, { "name": "paragonie/random_compat", "version": "v2.0.4", @@ -1626,79 +1388,6 @@ ], "time": "2016-10-10T12:19:37+00:00" }, - { - "name": "psy/psysh", - "version": "v0.8.1", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", - "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", - "shasum": "" - }, - "require": { - "dnoegel/php-xdg-base-dir": "0.1", - "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.3|~2.0|~3.0", - "php": ">=5.3.9", - "symfony/console": "~2.3.10|^2.4.2|~3.0", - "symfony/var-dumper": "~2.7|~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "hoa/console": "~3.16|~1.14", - "phpunit/phpunit": "~4.4|~5.0", - "symfony/finder": "~2.1|~3.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.9.x-dev" - } - }, - "autoload": { - "files": [ - "src/Psy/functions.php" - ], - "psr-4": { - "Psy\\": "src/Psy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ], - "time": "2017-01-15T17:54:13+00:00" - }, { "name": "ramsey/uuid", "version": "3.5.2", @@ -1950,16 +1639,16 @@ }, { "name": "symfony/console", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52" + "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", - "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", + "url": "https://api.github.com/repos/symfony/console/zipball/4f9e449e76996adf310498a8ca955c6deebe29dd", + "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd", "shasum": "" }, "require": { @@ -1970,17 +1659,19 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2007,20 +1698,73 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-01-08T20:43:43+00:00" + "time": "2017-01-08T20:47:33+00:00" }, { - "name": "symfony/debug", + "name": "symfony/css-selector", "version": "v3.1.10", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "c6661361626b3cf5cf2089df98b3b5006a197e85" + "url": "https://github.com/symfony/css-selector.git", + "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/c6661361626b3cf5cf2089df98b3b5006a197e85", - "reference": "c6661361626b3cf5cf2089df98b3b5006a197e85", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", + "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2017-01-02T20:31:54+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.2.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/810ba5c1c5352a4ddb15d4719e8936751dff0b05", + "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05", "shasum": "" }, "require": { @@ -2037,7 +1781,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2064,7 +1808,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-01-28T00:04:57+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/event-dispatcher", @@ -2128,16 +1872,16 @@ }, { "name": "symfony/finder", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "59687a255d1562f2c17b012418273862083d85f7" + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/59687a255d1562f2c17b012418273862083d85f7", - "reference": "59687a255d1562f2c17b012418273862083d85f7", + "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6", + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6", "shasum": "" }, "require": { @@ -2146,7 +1890,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2173,20 +1917,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:31:54+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "cef0ad49a2e90455cfc649522025b5a2929648c0" + "reference": "33eb76bf1d833c705433e5361a646c164696394b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/cef0ad49a2e90455cfc649522025b5a2929648c0", - "reference": "cef0ad49a2e90455cfc649522025b5a2929648c0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/33eb76bf1d833c705433e5361a646c164696394b", + "reference": "33eb76bf1d833c705433e5361a646c164696394b", "shasum": "" }, "require": { @@ -2199,7 +1943,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2226,20 +1970,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-01-08T20:43:43+00:00" + "time": "2017-01-08T20:47:33+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "c830387dec1b48c100473d10a6a356c3c3ae2a13" + "reference": "8a898e340a89022246645b1288d295f49c9381e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c830387dec1b48c100473d10a6a356c3c3ae2a13", - "reference": "c830387dec1b48c100473d10a6a356c3c3ae2a13", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/8a898e340a89022246645b1288d295f49c9381e4", + "reference": "8a898e340a89022246645b1288d295f49c9381e4", "shasum": "" }, "require": { @@ -2267,7 +2011,7 @@ "symfony/stopwatch": "~2.8|~3.0", "symfony/templating": "~2.8|~3.0", "symfony/translation": "~2.8|~3.0", - "symfony/var-dumper": "~2.8|~3.0" + "symfony/var-dumper": "~3.2" }, "suggest": { "symfony/browser-kit": "", @@ -2281,7 +2025,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2308,7 +2052,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-01-28T02:53:17+00:00" + "time": "2017-01-12T21:36:33+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -2479,16 +2223,16 @@ }, { "name": "symfony/process", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "2605753c5f8c531623d24d002825ebb1d6a22248" + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/2605753c5f8c531623d24d002825ebb1d6a22248", - "reference": "2605753c5f8c531623d24d002825ebb1d6a22248", + "url": "https://api.github.com/repos/symfony/process/zipball/350e810019fc52dd06ae844b6a6d382f8a0e8893", + "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893", "shasum": "" }, "require": { @@ -2497,7 +2241,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2524,20 +2268,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-21T17:13:55+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/routing", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "f25581d4eb0a82962c291917f826166f0dcd8a9a" + "reference": "fda2c67d47ec801726ca888c95d701d31b27b444" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/f25581d4eb0a82962c291917f826166f0dcd8a9a", - "reference": "f25581d4eb0a82962c291917f826166f0dcd8a9a", + "url": "https://api.github.com/repos/symfony/routing/zipball/fda2c67d47ec801726ca888c95d701d31b27b444", + "reference": "fda2c67d47ec801726ca888c95d701d31b27b444", "shasum": "" }, "require": { @@ -2566,7 +2310,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2599,20 +2343,20 @@ "uri", "url" ], - "time": "2017-01-28T00:04:57+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/translation", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d5a20fab5f63f44c233c69b3041c3cb1d4945e45" + "reference": "6520f3d4cce604d9dd1e86cac7af954984dd9bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d5a20fab5f63f44c233c69b3041c3cb1d4945e45", - "reference": "d5a20fab5f63f44c233c69b3041c3cb1d4945e45", + "url": "https://api.github.com/repos/symfony/translation/zipball/6520f3d4cce604d9dd1e86cac7af954984dd9bda", + "reference": "6520f3d4cce604d9dd1e86cac7af954984dd9bda", "shasum": "" }, "require": { @@ -2636,7 +2380,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2663,20 +2407,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-01-21T17:01:39+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.1.10", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "16df11647e5b992d687cb4eeeb9a882d5f5c26b9" + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/16df11647e5b992d687cb4eeeb9a882d5f5c26b9", - "reference": "16df11647e5b992d687cb4eeeb9a882d5f5c26b9", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b54b23f9a19b465e76fdaac0f6732410467c83b2", + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2", "shasum": "" }, "require": { @@ -2692,7 +2436,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2726,20 +2470,67 @@ "debug", "dump" ], - "time": "2017-01-24T13:02:38+00:00" + "time": "2017-01-03T08:53:57+00:00" }, { - "name": "twig/twig", - "version": "v1.31.0", + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.0", "source": { "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7" + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ddc9e3e20ee9c0b6908f401ac8353635b750eca7", - "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", + "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7", + "symfony/css-selector": "^2.7|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|5.1.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2016-09-20T12:50:39+00:00" + }, + { + "name": "twig/twig", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "c6ff71094fde15d12398eaba029434b013dc5e59" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/c6ff71094fde15d12398eaba029434b013dc5e59", + "reference": "c6ff71094fde15d12398eaba029434b013dc5e59", "shasum": "" }, "require": { @@ -2747,12 +2538,12 @@ }, "require-dev": { "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.2" + "symfony/phpunit-bridge": "~3.2@dev" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.31-dev" + "dev-master": "1.30-dev" } }, "autoload": { @@ -2787,7 +2578,7 @@ "keywords": [ "templating" ], - "time": "2017-01-11T19:36:15+00:00" + "time": "2016-12-23T11:06:22+00:00" }, { "name": "vlucas/phpdotenv", @@ -4538,59 +4329,6 @@ "homepage": "https://symfony.com", "time": "2017-01-10T14:14:38+00:00" }, - { - "name": "symfony/css-selector", - "version": "v3.1.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", - "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2017-01-02T20:31:54+00:00" - }, { "name": "symfony/dom-crawler", "version": "v3.1.10", @@ -4760,8 +4498,7 @@ "prefer-lowest": false, "platform": { "php": ">=7.0.0", - "ext-intl": "*", - "ext-bcmath": "*" + "ext-intl": "*" }, "platform-dev": [] } diff --git a/config/app.php b/config/app.php index 4933ad1c8c..1bbf9d2452 100755 --- a/config/app.php +++ b/config/app.php @@ -26,8 +26,8 @@ return [ 'providers' => [ /* - * Laravel Framework Service Providers... - */ + * Laravel Framework Service Providers... + */ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, @@ -50,12 +50,11 @@ return [ Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, - Collective\Html\HtmlServiceProvider::class, - /* * Application Service Providers... */ + FireflyIII\Providers\LogServiceProvider::class, FireflyIII\Providers\AppServiceProvider::class, FireflyIII\Providers\AuthServiceProvider::class, // FireflyIII\Providers\BroadcastServiceProvider::class, @@ -74,7 +73,6 @@ return [ /* * More service providers. */ - FireflyIII\Providers\CrudServiceProvider::class, FireflyIII\Providers\AccountServiceProvider::class, FireflyIII\Providers\AttachmentServiceProvider::class, FireflyIII\Providers\BillServiceProvider::class, @@ -92,11 +90,12 @@ return [ ], 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, 'Auth' => Illuminate\Support\Facades\Auth::class, 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, 'Cache' => Illuminate\Support\Facades\Cache::class, 'Config' => Illuminate\Support\Facades\Config::class, 'Cookie' => Illuminate\Support\Facades\Cookie::class, diff --git a/phpunit.xml b/phpunit.xml index 9f026f875f..c096c7a945 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,7 +17,6 @@ ./tests/unit - ./app diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php new file mode 100644 index 0000000000..8d8a77e99d --- /dev/null +++ b/tests/CreatesApplication.php @@ -0,0 +1,22 @@ +make(Kernel::class)->bootstrap(); + + return $app; + } +} \ No newline at end of file diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php deleted file mode 100644 index 74a0a460d6..0000000000 --- a/tests/ExampleTest.php +++ /dev/null @@ -1,27 +0,0 @@ -visit('/') - ->see('Firefly'); - } -} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php new file mode 100644 index 0000000000..c23bfc63d5 --- /dev/null +++ b/tests/Feature/ExampleTest.php @@ -0,0 +1,23 @@ +get('/'); + + $response->assertStatus(200); + } +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php index c2a57c8e43..03cde96b56 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,153 +1,15 @@ id)->where('name', 'viewRange')->delete(); - Preference::create( - [ - 'user_id' => $user->id, - 'name' => 'viewRange', - 'data' => $range, - ] - ); - // set period to match? - - } - if ($range === 'custom') { - $this->session( - [ - 'start' => Carbon::now()->subDays(20), - 'end' => Carbon::now(), - ] - ); - } - } - - /** - * Creates the application. - * - * @return \Illuminate\Foundation\Application - */ - public function createApplication() - { - $app = require __DIR__ . '/../bootstrap/app.php'; - - $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); - - return $app; - } - - /** - * @return array - */ - public function dateRangeProvider() - { - return [ - 'one day' => ['1D'], - 'one week' => ['1W'], - 'one month' => ['1M'], - 'three months' => ['3M'], - 'six months' => ['6M'], - 'one year' => ['1Y'], - 'custom range' => ['custom'], - ]; - } - - /** - * @return User - */ - public function emptyUser() - { - $user = User::find(2); - - return $user; - } - - /** - * @return array - */ - public function naughtyStringProvider() - { - /* - * If on Travis, return very small set. - */ - if (getenv('TRAVIS') == 'true') { - return [['Default value']]; - - } - $path = realpath(__DIR__ . '/../resources/tests/blns.base64.json'); - $content = file_get_contents($path); - $array = json_decode($content); - $return = []; - foreach ($array as $entry) { - $return[] = [base64_decode($entry)]; - } - - return $return; - } - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - public function setUp() - { - parent::setUp(); - - } - - /** - * @return User - */ - public function user() - { - $user = User::find(1); - - return $user; - } - - /** - * @param string $class - * - * @return \Mockery\MockInterface - */ - protected function mock($class) - { - Log::debug(sprintf('Will now mock %s', $class)); - $object = Mockery::mock($class); - $this->app->instance($class, $object); - - return $object; - } -} + use CreatesApplication; +} \ No newline at end of file diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php new file mode 100644 index 0000000000..239346394a --- /dev/null +++ b/tests/Unit/ExampleTest.php @@ -0,0 +1,20 @@ +assertTrue(true); + } +} \ No newline at end of file diff --git a/tests/acceptance/Controllers/AccountControllerTest.php b/tests/acceptance/Controllers/AccountControllerTest.php deleted file mode 100644 index e42a5a8d1a..0000000000 --- a/tests/acceptance/Controllers/AccountControllerTest.php +++ /dev/null @@ -1,224 +0,0 @@ -be($this->user()); - $this->call('GET', route('accounts.create', ['asset'])); - $this->assertResponseStatus(200); - // has bread crumb - $this->see('