Conditions | 3 |
Paths | 1 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
26 | public static function build(OutputInterface $output, string $action, string $index, int $offset): \Closure |
||
27 | { |
||
28 | $progress = null; |
||
29 | |||
30 | return function ($increment, $totalObjects, $message = null) use (&$progress, $output, $action, $index, $offset) { |
||
31 | if (null === $progress) { |
||
32 | $progress = new ProgressBar($output, $totalObjects); |
||
33 | $progress->start(); |
||
34 | $progress->setProgress($offset); |
||
35 | } |
||
36 | |||
37 | if (null !== $message) { |
||
38 | $progress->clear(); |
||
39 | $output->writeln(\sprintf('<info>%s</info> <error>%s</error>', $action, $message)); |
||
40 | $progress->display(); |
||
41 | } |
||
42 | |||
43 | $progress->setMessage(\sprintf('<info>%s</info> <comment>%s</comment>', $action, $index)); |
||
44 | $progress->advance($increment); |
||
45 | }; |
||
46 | } |
||
47 | } |
||
48 |