| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function findTaskDispatcherByDefinition(TaskDefinitionInterface $taskDefinition): TaskDefinitionDispatcherInterface |
||
| 31 | { |
||
| 32 | /* @var DispatcherCollection $dispatcherCollection */ |
||
| 33 | $dispatcherCollection = $this->container->get(DispatcherCollection::class); |
||
| 34 | |||
| 35 | foreach($dispatcherCollection->toArray() as $dispatcher){ |
||
| 36 | if($dispatcher->canDispatchTaskDefinition($taskDefinition) === true){ |
||
| 37 | return $dispatcher; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | throw new DispatcherException(sprintf('No dispatcher found for %s task', get_class($taskDefinition))); |
||
| 42 | } |
||
| 43 | } |