1 | <?php |
||
30 | class CompositeTaskFactory implements TaskFactoryInterface |
||
31 | { |
||
32 | /** |
||
33 | * The registered factories. |
||
34 | * |
||
35 | * @var TaskFactoryInterface[] |
||
36 | */ |
||
37 | private $factories = []; |
||
38 | |||
39 | /** |
||
40 | * Create an instance containing the passed factories. |
||
41 | * |
||
42 | * @param TaskFactoryInterface[] $factories The factories to add. |
||
43 | */ |
||
44 | public function __construct(array $factories = []) |
||
50 | |||
51 | /** |
||
52 | * Add the passed factory. |
||
53 | * |
||
54 | * @param TaskFactoryInterface $factory The factory to add. |
||
55 | * |
||
56 | * @return CompositeTaskFactory |
||
57 | */ |
||
58 | public function add(TaskFactoryInterface $factory) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function isTypeSupported($taskType) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | * |
||
76 | * @throws \InvalidArgumentException For unsupported task types. |
||
77 | */ |
||
78 | public function createInstance($taskType, JsonArray $metaData) |
||
86 | |||
87 | /** |
||
88 | * Search the factory that can handle the type. |
||
89 | * |
||
90 | * @param string $taskType The task type to search. |
||
91 | * |
||
92 | * @return null|TaskFactoryInterface |
||
93 | */ |
||
94 | private function getFactoryForType($taskType) |
||
104 | } |
||
105 |