1 | <?php |
||
33 | class Factory |
||
34 | { |
||
35 | /** |
||
36 | * @var Console |
||
37 | */ |
||
38 | protected $console; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $namespaces = [ |
||
44 | 'task' => [ |
||
45 | 'Netresearch\Kite\Task' |
||
46 | ], |
||
47 | 'workflow' => [ |
||
48 | 'Netresearch\Kite\Workflow' |
||
49 | ] |
||
50 | ]; |
||
51 | |||
52 | /** |
||
53 | * Construct factory |
||
54 | * |
||
55 | * @param Console $console Optional console (passed to Job) |
||
56 | */ |
||
57 | public function __construct(Console $console) |
||
61 | |||
62 | /** |
||
63 | * Create a job |
||
64 | * |
||
65 | * @param string $job The job name |
||
66 | * |
||
67 | * @return Job |
||
68 | */ |
||
69 | public function createJob($job) |
||
74 | |||
75 | /** |
||
76 | * Create/validate a workflow |
||
77 | * |
||
78 | * @param string|Workflow $workflow The workflow definition |
||
79 | * @param Variables $variables Parent object for the workflow |
||
80 | * |
||
81 | * @return Workflow |
||
82 | */ |
||
83 | public function createWorkflow($workflow, Variables $variables) |
||
94 | |||
95 | /** |
||
96 | * Create a task |
||
97 | * |
||
98 | * @param string|array|callable $task The task name, it's properies or a callable |
||
99 | * @param Variables $variables The parent variables object for the task |
||
100 | * @param array $options Options for the task |
||
101 | * |
||
102 | * @return \Netresearch\Kite\Task |
||
103 | */ |
||
104 | public function createTask($task, Variables $variables, array $options = array()) |
||
135 | |||
136 | /** |
||
137 | * Get the full class name from a task definition |
||
138 | * |
||
139 | * @param string $definition Last part of class name without postfix or full class name |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | public function getTaskClassName($definition) |
||
147 | |||
148 | /** |
||
149 | * Get the full class name from a workflow definition |
||
150 | * |
||
151 | * @param string $definition Last part of class name without postfix or full class name |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getWorkflowClassName($definition) |
||
159 | |||
160 | /** |
||
161 | * Get the full class name from a definition |
||
162 | * |
||
163 | * @param string $definition Last part of class name without postfix or full class name |
||
164 | * @param string $type "workflow" or "task" currently |
||
165 | * @param bool $postfixType Whether $type is required as postfix at the class name |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | protected function getClassName($definition, $type, $postfixType = true) |
||
186 | |||
187 | /** |
||
188 | * Get the namespaces - either for a specific type or all |
||
189 | * |
||
190 | * @param string|null $type workflow or tasks |
||
191 | * |
||
192 | * @return array |
||
193 | */ |
||
194 | public function getNamespaces($type = null) |
||
198 | } |
||
199 | ?> |
||
200 |