dispatcher = $dispatcher; $this->logger = $logger; } public function create($fqn) { if (!class_exists($fqn)) { $tryFqn = __NAMESPACE__ . '\\' . $fqn . 'Job'; if (!class_exists($tryFqn)) { throw new InvalidArgumentException(sprintf('Job `%s` not found.', $fqn)); } $fqn = $tryFqn; } if (!in_array('Alchemy\Phrasea\TaskManager\Job\JobInterface', class_implements($fqn))) { throw new InvalidArgumentException(sprintf('Class `%s` does not implement JobInterface.', $fqn)); } return new $fqn($this->dispatcher, $this->logger); } }