for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SfCod\QueueBundle\Service;
use SfCod\QueueBundle\Base\JobInterface;
use SfCod\QueueBundle\Base\JobResolverInterface;
use SfCod\QueueBundle\Exception\FatalThrowableException;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Class JobResolver
*
* @author Virchenko Maksim <[email protected]>
* @package SfCod\QueueBundle\Service
*/
class JobResolver implements JobResolverInterface
{
* @var JobInterface[]
private $jobs = [];
* Resolve the given class.
* @param string $id
* @return JobInterface
public function resolve(string $id): JobInterface
if (isset($this->jobs[$id])) {
return $this->jobs[$id];
}
throw new FatalThrowableException("Job handler '$id' not found.");
* @inheritDoc
* @param JobInterface $job
public function addJob(string $id, JobInterface $job)
$this->jobs[$id] = $job;