1 | <?php |
||
18 | class Producer |
||
19 | { |
||
20 | |||
21 | const ERROR_CONFIG_WITH_EMPTY_TASK = 'Config with empty task'; |
||
22 | 6 | const PLACEHOLDER_TASK_SUCCESS = ' + Ok :'; |
|
23 | const PLACEHOLDER_TASK_FAIL = ' - Fail :'; |
||
24 | 6 | const PLACEHOLDER_TASK_ERROR = ' - Error :'; |
|
25 | 6 | ||
26 | /** |
||
27 | 6 | * @var array |
|
28 | */ |
||
29 | 6 | protected $taskSet = []; |
|
30 | |||
31 | 6 | /** |
|
32 | * @var AbstractChecker[] |
||
33 | */ |
||
34 | protected $checkerSet = []; |
||
35 | |||
36 | 5 | /** |
|
37 | * @var AbstractOutput |
||
38 | 5 | */ |
|
39 | 5 | protected $outputHandler; |
|
40 | |||
41 | /** |
||
42 | 3 | * @var array |
|
43 | */ |
||
44 | protected $taskFail = []; |
||
45 | 3 | ||
46 | 1 | /** |
|
47 | * @var array |
||
48 | */ |
||
49 | 3 | protected $taskError = []; |
|
50 | |||
51 | /** |
||
52 | 2 | * @var array |
|
53 | */ |
||
54 | 2 | protected $taskSuccess = []; |
|
55 | |||
56 | 2 | /** |
|
57 | * Producer constructor. |
||
58 | * |
||
59 | 2 | * @param array $taskSet |
|
60 | */ |
||
61 | 2 | public function __construct(array $taskSet = []) |
|
65 | |||
66 | 1 | /** |
|
67 | * @param array $taskSet |
||
68 | * |
||
69 | 1 | * @return $this |
|
70 | 1 | */ |
|
71 | 1 | public function setTaskSet(array $taskSet) |
|
77 | |||
78 | 1 | /** |
|
79 | * @param AbstractOutput $outputHandler |
||
80 | * |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function setOutputHandler(AbstractOutput $outputHandler) |
||
89 | 3 | ||
90 | 3 | /** |
|
91 | * @return AbstractOutput|Console |
||
92 | */ |
||
93 | 3 | public function getOutputHandler() |
|
101 | |||
102 | 1 | /** |
|
103 | 1 | * @param string $msg |
|
104 | 1 | * @param string $type |
|
105 | * |
||
106 | 1 | * @return $this |
|
107 | */ |
||
108 | 1 | public function output($msg = '', $type = AbstractOutput::TYPE_DEFAULT) |
|
114 | |||
115 | /** |
||
116 | 2 | * @return $this |
|
117 | */ |
||
118 | 2 | public function run() |
|
139 | |||
140 | 1 | /** |
|
141 | 1 | * @param $checkerAlias |
|
142 | 1 | * |
|
143 | 1 | * @return AbstractChecker |
|
144 | 1 | */ |
|
145 | public function createChecker($checkerAlias) |
||
159 | |||
160 | /** |
||
161 | 1 | * @param AbstractResultException $resultException |
|
162 | 1 | * |
|
163 | 1 | * @return $this |
|
164 | 1 | */ |
|
165 | 1 | protected function renderTask(AbstractResultException $resultException) |
|
180 | 2 | ||
181 | 2 | /** |
|
182 | 2 | * @param $text |
|
183 | 2 | * |
|
184 | 2 | * @return $this |
|
185 | 2 | */ |
|
186 | 2 | protected function renderHeader($text) |
|
196 | |||
197 | 2 | /** |
|
198 | * @return $this |
||
199 | */ |
||
200 | protected function renderStats() |
||
221 | |||
222 | /** |
||
223 | * @param array $list |
||
224 | * @param string $title |
||
225 | * |
||
226 | * @return $this |
||
227 | */ |
||
228 | protected function renderList(array $list, $title = '') |
||
254 | |||
255 | /** |
||
256 | * @param array $task |
||
257 | * |
||
258 | * @return \Exception|ErrorException|FailException|SuccessException |
||
259 | */ |
||
260 | public function runTask(array $task = []) |
||
282 | } |