1 | <?php |
||
20 | class TaskRunner |
||
21 | { |
||
22 | /** |
||
23 | * The task manager. |
||
24 | * |
||
25 | * @var TaskManager |
||
26 | */ |
||
27 | protected $taskManager; |
||
28 | |||
29 | /** |
||
30 | * The output. |
||
31 | * |
||
32 | * @var OutputInterface |
||
33 | */ |
||
34 | protected $output; |
||
35 | |||
36 | /** |
||
37 | * The logger. |
||
38 | * |
||
39 | * @var LoggerInterface |
||
40 | */ |
||
41 | protected $logger; |
||
42 | |||
43 | /** |
||
44 | * Create task runner object. |
||
45 | * |
||
46 | * @param TaskManager $taskManager |
||
47 | * @param OutputInterface $output |
||
48 | * @param LoggerInterface $logger |
||
49 | */ |
||
50 | 2 | public function __construct(TaskManager $taskManager, OutputInterface $output, LoggerInterface $logger) |
|
56 | |||
57 | /** |
||
58 | * Gets called when the object is used as a callback. |
||
59 | * |
||
60 | * @param string $type |
||
61 | * @param string $buffer |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | 1 | public function __invoke($type, $buffer) |
|
70 | |||
71 | /** |
||
72 | * Log message. |
||
73 | * |
||
74 | * @param string $type |
||
75 | * @param string $message |
||
76 | * |
||
77 | * @return void |
||
78 | */ |
||
79 | 1 | protected function logMessage($type, $message) |
|
88 | |||
89 | /** |
||
90 | * Render output. |
||
91 | * |
||
92 | * @param string $type |
||
93 | * @param string $message |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | 1 | protected function renderOutput($type, $message) |
|
109 | |||
110 | /** |
||
111 | * Run all tasks from the task manager. |
||
112 | * |
||
113 | * @param int $timeout |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | 2 | public function runAll($timeout) |
|
123 | |||
124 | /** |
||
125 | * Run single task. |
||
126 | * |
||
127 | * @param Task $task |
||
128 | * @param int $timeout |
||
129 | * |
||
130 | * @return void |
||
131 | */ |
||
132 | 2 | public function run($task, $timeout) |
|
144 | } |
||
145 |