Code for Spectre.

This commit is contained in:
James Cole
2018-05-16 21:31:45 +02:00
parent 9f26757e8a
commit dd44a1e517
3 changed files with 15 additions and 3 deletions

View File

@@ -54,17 +54,20 @@ class SpectreRoutine implements RoutineInterface
*/
public function run(): void
{
if ($this->importJob->status === 'ready_to_run') {
$valid = ['ready_to_run','error']; // should be only ready_to_run
if(in_array($this->importJob->status, $valid)) {
switch ($this->importJob->stage) {
default:
throw new FireflyException(sprintf('SpectreRoutine cannot handle stage "%s".', $this->importJob->stage));
case 'new':
case 'authenticate':
/** @var StageNewHandler $handler */
$handler = app(StageNewHandler::class);
$handler->setImportJob($this->importJob);
$handler->run();
$this->repository->setStage($this->importJob, 'authenticate');
var_dump($this->repository->getConfiguration($this->importJob));
exit;
break;
}
}