1 | <?php |
||
27 | abstract class Task extends Variables |
||
28 | { |
||
29 | /** |
||
30 | * @var \Netresearch\Kite\Service\Console |
||
31 | */ |
||
32 | public $console; |
||
33 | |||
34 | /** |
||
35 | * @var Job |
||
36 | */ |
||
37 | protected $job; |
||
38 | |||
39 | /** |
||
40 | * Task constructor. |
||
41 | * |
||
42 | * @param Variables $parent Parent object (Task/Job/Workflow) |
||
43 | */ |
||
44 | public function __construct(Variables $parent) |
||
51 | |||
52 | /** |
||
53 | * Configures the available options |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | protected function configureVariables() |
||
104 | |||
105 | /** |
||
106 | * Handle onBefore, onAfter and name |
||
107 | * |
||
108 | * @param mixed $offset The name of the variable |
||
109 | * @param mixed $value The value |
||
110 | * |
||
111 | * @return void |
||
112 | */ |
||
113 | public function offsetSet($offset, $value) |
||
129 | |||
130 | /** |
||
131 | * Re-add the onBefore and onAfter tasks and regenerate name |
||
132 | * |
||
133 | * @return void |
||
134 | */ |
||
135 | public function __clone() |
||
145 | |||
146 | /** |
||
147 | * Handle name |
||
148 | * |
||
149 | * @param mixed $offset The variable name |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | public function offsetExists($offset) |
||
157 | |||
158 | /** |
||
159 | * Generate name if it doesn't exist |
||
160 | * |
||
161 | * @param mixed $offset The name of the variable |
||
162 | * |
||
163 | * @return mixed |
||
164 | */ |
||
165 | public function &offsetGet($offset) |
||
172 | |||
173 | /** |
||
174 | * Called from parent task as soon as task is ready to run - which doesn't |
||
175 | * necessarely mean that it'll be run. |
||
176 | * |
||
177 | * @return void |
||
178 | */ |
||
179 | protected function initialize() |
||
182 | |||
183 | /** |
||
184 | * Shortcut to set() |
||
185 | * |
||
186 | * @param bool $flag The flag |
||
187 | * |
||
188 | * @return $this |
||
189 | */ |
||
190 | public function executeInPreview($flag = true) |
||
194 | |||
195 | /** |
||
196 | * Shortcut to set() |
||
197 | * |
||
198 | * @param string $var The variable name |
||
199 | * |
||
200 | * @return $this |
||
201 | */ |
||
202 | public function toVar($var) |
||
206 | |||
207 | /** |
||
208 | * Shortcut to set() |
||
209 | * |
||
210 | * @param bool $flag The flag |
||
211 | * |
||
212 | * @return $this |
||
213 | */ |
||
214 | public function force($flag = true) |
||
218 | |||
219 | /** |
||
220 | * Shortcut to set() |
||
221 | * |
||
222 | * @param string $message The message |
||
223 | * |
||
224 | * @return $this |
||
225 | */ |
||
226 | public function message($message) |
||
230 | |||
231 | /** |
||
232 | * Shortcut to set() |
||
233 | * |
||
234 | * @param string|callable|boolean $condition The condition |
||
235 | * |
||
236 | * @return $this |
||
237 | */ |
||
238 | public function when($condition) |
||
242 | |||
243 | /** |
||
244 | * Run this task |
||
245 | * |
||
246 | * @throws Exception |
||
247 | * |
||
248 | * @return mixed |
||
249 | */ |
||
250 | public function run() |
||
257 | |||
258 | /** |
||
259 | * Determines whether this task should be executed |
||
260 | * |
||
261 | * @return bool |
||
262 | */ |
||
263 | protected function shouldExecute() |
||
267 | |||
268 | /** |
||
269 | * The preview for this task - this is called right before execution and |
||
270 | * in preview mode |
||
271 | * |
||
272 | * @return void |
||
273 | */ |
||
274 | public function preview() |
||
281 | |||
282 | /** |
||
283 | * Actually execute this task |
||
284 | * |
||
285 | * @return mixed |
||
286 | */ |
||
287 | public function execute() |
||
291 | } |
||
292 | ?> |
||
293 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.