Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function getTaskFromTaskEvent(TaskEventInterface $taskEvent) |
||
24 | { |
||
25 | $className = $this->registry->getClassByName($taskEvent->getTaskName()); |
||
26 | |||
27 | /** @var TaskTypeInterface $task */ |
||
28 | $task = new $className(); |
||
29 | |||
30 | if (!$task instanceof TaskTypeInterface) { |
||
31 | $error = sprintf("Invalid Task Event provided. %s is not a valid task", $className); |
||
32 | throw new TaskException($error); |
||
33 | } |
||
34 | |||
35 | $task->setFromPayload($taskEvent->getPayload()); |
||
36 | |||
37 | return $task; |
||
38 | } |
||
39 | } |
||
40 |