1 | <?php |
||
18 | class ContainerAwareProcessorFactory extends ProcessorFactory |
||
19 | { |
||
20 | /** |
||
21 | * Service container. |
||
22 | * |
||
23 | * @var ContainerInterface |
||
24 | */ |
||
25 | private $container; |
||
26 | |||
27 | /** |
||
28 | * Registered services IDs. |
||
29 | * |
||
30 | * @var int[] |
||
31 | */ |
||
32 | private $serviceIds = array(); |
||
33 | |||
34 | /** |
||
35 | * Class constructor. |
||
36 | * |
||
37 | * @param ContainerInterface $container A ContainerInterface instance |
||
38 | * @param LoggerInterface Logger instance |
||
39 | */ |
||
40 | 5 | public function __construct(ContainerInterface $container, LoggerInterface $logger = null) |
|
45 | |||
46 | /** |
||
47 | * Register processor service for command class. |
||
48 | * |
||
49 | * @param string $commandClassName |
||
50 | * @param string $serviceId |
||
51 | * @throws MultipleProcessorsException Thrown, when several processors are registered for given class. |
||
52 | */ |
||
53 | 3 | public function registerProcessorIdForCommand($commandClassName, $serviceId) |
|
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | 4 | public function hasProcessor($commandClassName) |
|
66 | { |
||
67 | 4 | return parent::hasProcessor($commandClassName) || array_key_exists($commandClassName, $this->serviceIds) ; |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Get processor for class name, if any is registered. |
||
72 | * |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 2 | public function getProcessor(CommandInterface $command) |
|
89 | } |
||
90 |