|
1 | 1 | <?php |
2 | 2 |
|
3 | | -namespace SensioLabs\DeprecationDetector\Violation\Renderer; |
| 3 | +namespace SensioLabs\DeprecationDetector\Violation\Renderer\Console; |
4 | 4 |
|
5 | | -use PhpParser\Error; |
6 | 5 | use SensioLabs\DeprecationDetector\FileInfo\PhpFileInfo; |
7 | 6 | use SensioLabs\DeprecationDetector\Violation\Renderer\MessageHelper\MessageHelper; |
8 | 7 | use SensioLabs\DeprecationDetector\Violation\Violation; |
|
11 | 10 | use Symfony\Component\Console\Helper\TableSeparator; |
12 | 11 | use Symfony\Component\Console\Output\OutputInterface; |
13 | 12 |
|
14 | | -class ConsoleOutputRenderer implements RendererInterface |
| 13 | +class DefaultRenderer extends BaseRenderer |
15 | 14 | { |
16 | | - /** |
17 | | - * @var OutputInterface |
18 | | - */ |
19 | | - protected $output; |
20 | | - |
21 | | - /** |
22 | | - * @var MessageHelper |
23 | | - */ |
24 | | - private $messageHelper; |
25 | | - |
26 | 15 | /** |
27 | 16 | * @param OutputInterface $output |
28 | 17 | * @param MessageHelper $messageHelper |
29 | 18 | */ |
30 | 19 | public function __construct(OutputInterface $output, MessageHelper $messageHelper) |
31 | 20 | { |
32 | | - $this->output = $output; |
33 | | - $this->messageHelper = $messageHelper; |
| 21 | + parent::__construct($output, $messageHelper); |
34 | 22 | } |
35 | 23 |
|
36 | 24 | /** |
37 | 25 | * @param Violation[] $violations |
38 | | - * @param Error[] $errors |
39 | 26 | */ |
40 | | - public function renderViolations(array $violations, array $errors) |
41 | | - { |
42 | | - $this->printViolations($violations); |
43 | | - $this->printErrors($errors); |
44 | | - } |
45 | | - |
46 | | - /** |
47 | | - * @param Violation[] $violations |
48 | | - */ |
49 | | - private function printViolations(array $violations) |
| 27 | + protected function printViolations(array $violations) |
50 | 28 | { |
51 | 29 | if (0 === count($violations)) { |
52 | 30 | return; |
@@ -77,26 +55,6 @@ private function printViolations(array $violations) |
77 | 55 | $table->render(); |
78 | 56 | } |
79 | 57 |
|
80 | | - /** |
81 | | - * @param Error[] $errors |
82 | | - */ |
83 | | - private function printErrors(array $errors) |
84 | | - { |
85 | | - if (0 === count($errors)) { |
86 | | - return; |
87 | | - } |
88 | | - |
89 | | - $this->output->writeln('<error>Your project contains invalid code:</error>'); |
90 | | - foreach ($errors as $error) { |
91 | | - $this->output->writeln( |
92 | | - sprintf( |
93 | | - '<error>%s</error>', |
94 | | - $error->getRawMessage() |
95 | | - ) |
96 | | - ); |
97 | | - } |
98 | | - } |
99 | | - |
100 | 58 | /** |
101 | 59 | * @param PhpFileInfo $file |
102 | 60 | * |
|
0 commit comments