. */ declare(strict_types=1); namespace FireflyIII\Support\Import\JobConfiguration\Bunq; use FireflyIII\Models\ImportJob; use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface; use Illuminate\Support\MessageBag; use Log; /** * Class NewBunqJobHandler */ class NewBunqJobHandler implements BunqJobConfigurationInterface { /** @var ImportJob */ private $importJob; /** @var ImportJobRepositoryInterface */ private $repository; /** * Return true when this stage is complete. * * @return bool */ public function configurationComplete(): bool { // simply set the job configuration "apply-rules" to true. $config = $this->repository->getConfiguration($this->importJob); $config['apply-rules'] = true; $this->repository->setConfiguration($this->importJob, $config); return true; } /** * @codeCoverageIgnore * Store the job configuration. * * @param array $data * * @return MessageBag */ public function configureJob(array $data): MessageBag { Log::debug('NewBunqJobHandler::configureJob always returns an empty message bag.'); return new MessageBag; } /** * @codeCoverageIgnore * Get data for config view. * * @return array */ public function getNextData(): array { Log::debug('NewBunqJobHandler::getNextData always returns an empty array.'); return []; } /** * @codeCoverageIgnore * Get the view for this stage. * * @return string */ public function getNextView(): string { Log::debug('NewBunqJobHandler::getNextView always returns "".'); return ''; } /** * Set the import job. * * @param ImportJob $importJob */ public function setImportJob(ImportJob $importJob): void { $this->importJob = $importJob; $this->repository = app(ImportJobRepositoryInterface::class); $this->repository->setUser($importJob->user); } }