doyolabs /
code-coverage
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file is part of the doyo/code-coverage project. |
||
| 5 | * |
||
| 6 | * (c) Anthonius Munthi <https://itstoni.com> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Doyo\Bridge\CodeCoverage\Console; |
||
| 15 | |||
| 16 | use Symfony\Component\Console\Input\InputInterface; |
||
| 17 | use Symfony\Component\Console\Output\OutputInterface; |
||
| 18 | use Symfony\Component\Console\Style\StyleInterface; |
||
| 19 | use Symfony\Component\Console\Style\SymfonyStyle; |
||
| 20 | |||
| 21 | class Console implements ConsoleIO |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var StyleInterface |
||
| 25 | */ |
||
| 26 | private $style; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Console constructor. |
||
| 30 | * |
||
| 31 | * @todo Change this to only accept style interface |
||
| 32 | * |
||
| 33 | * @param InputInterface|StyleInterface $style |
||
| 34 | * @param OutputInterface|null $output |
||
| 35 | */ |
||
| 36 | 6 | public function __construct($style, OutputInterface $output = null) |
|
| 37 | { |
||
| 38 | 6 | if ($style instanceof InputInterface) { |
|
| 39 | 2 | $style = new SymfonyStyle($style, $output); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 40 | } |
||
| 41 | 6 | $this->style = $style; |
|
| 42 | } |
||
| 43 | |||
| 44 | 2 | public function coverageSection(string $section) |
|
| 45 | { |
||
| 46 | 2 | $this->style->section('coverage: '.$section); |
|
| 47 | } |
||
| 48 | |||
| 49 | 2 | public function coverageInfo(string $message) |
|
| 50 | { |
||
| 51 | 2 | $this->style->text($message); |
|
| 52 | } |
||
| 53 | |||
| 54 | 1 | public function coverageError(string $message) |
|
| 55 | { |
||
| 56 | 1 | $this->style->error($message); |
|
| 57 | } |
||
| 58 | } |
||
| 59 |