1 | <?php |
||
23 | class Table |
||
24 | { |
||
25 | const SPINNER = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"; |
||
26 | |||
27 | /** @var Pool */ |
||
28 | private $processPool; |
||
29 | /** @var string[] */ |
||
30 | private $rows = []; |
||
31 | /** @var Exception[] */ |
||
32 | private $exceptions; |
||
33 | /** @var int[] */ |
||
34 | private $maxLengths = []; |
||
35 | /** @var DiffConsoleOutput */ |
||
36 | private $output; |
||
37 | /** @var TerminalInterface */ |
||
38 | private $terminal; |
||
39 | /** @var bool */ |
||
40 | private $showOutput = true; |
||
41 | |||
42 | /** |
||
43 | * Table constructor. |
||
44 | * |
||
45 | * @param OutputInterface $output |
||
46 | * @param Pool|null $pool |
||
47 | */ |
||
48 | public function __construct(OutputInterface $output, Pool $pool = null) |
||
60 | |||
61 | /** |
||
62 | * Parses the rows to determine the key lengths to make a pretty table |
||
63 | * |
||
64 | * @param array $data |
||
65 | */ |
||
66 | private function updateRowKeyLengths(array $data = []) |
||
80 | |||
81 | /** |
||
82 | * @param array $data |
||
83 | * @param string $status |
||
84 | * @param float $duration |
||
85 | * @param string $extra |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | private function formatRow(array $data, $status, $duration, $extra = '') |
||
99 | |||
100 | /** |
||
101 | * @param Process $process |
||
102 | * @param array $data |
||
103 | */ |
||
104 | public function add(Process $process, array $data = []) |
||
143 | |||
144 | /** |
||
145 | * Render a specific row |
||
146 | * |
||
147 | * @param int $row |
||
148 | */ |
||
149 | private function render($row = 0) |
||
157 | |||
158 | /** |
||
159 | * @param float $checkInterval |
||
160 | * |
||
161 | * @return bool true if all processes were successful |
||
162 | * @throws Exception |
||
163 | */ |
||
164 | public function run($checkInterval = Pool::CHECK_INTERVAL) |
||
181 | |||
182 | /** |
||
183 | * @return bool |
||
184 | */ |
||
185 | public function isShowOutput() |
||
189 | |||
190 | /** |
||
191 | * @param bool $showOutput |
||
192 | * |
||
193 | * @return $this |
||
194 | */ |
||
195 | public function setShowOutput($showOutput) |
||
201 | } |
||
202 |