11<?php
2+
23declare (strict_types=1 );
34
45namespace noximo ;
56
67use Nette \IOException ;
8+ use Nette \Neon \Neon ;
79use Nette \Utils \FileSystem ;
810use Nette \Utils \RegexpException ;
911use Nette \Utils \Strings ;
1416
1517class FileOutput implements ErrorFormatter
1618{
19+ /** @var string */
1720 public const ERROR = 'error ' ;
1821
22+ /** @var string */
1923 public const LINK = 'link ' ;
2024
25+ /** @var string */
2126 public const LINE = 'line ' ;
2227
28+ /** @var string */
2329 public const FILES = 'files ' ;
2430
31+ /** @var string */
2532 public const UNKNOWN = 'unknown ' ;
2633
34+ /** @var string */
35+ public const IGNORE = 'ignore ' ;
36+
2737 /** @var string */
2838 private $ link = 'editor://open/?file=%file&line=%line ' ;
2939
@@ -51,7 +61,7 @@ public function __construct(string $outputFile, ?ErrorFormatter $defaultFormatte
5161 $ this ->defaultFormatter = $ defaultFormatterClass ;
5262 $ cwd = \Safe \getcwd () . DIRECTORY_SEPARATOR ;
5363 try {
54- $ outputFile = Strings::replace ($ outputFile , '{time} ' , (string )time ());
64+ $ outputFile = Strings::replace ($ outputFile , '{time} ' , (string ) time ());
5565 } catch (RegexpException $ e ) {
5666 }
5767
@@ -114,9 +124,10 @@ private function generateFile(AnalysisResult $analysisResult): void
114124 $ line = $ fileSpecificError ->getLine () ?? 1 ;
115125 $ link = strtr ($ this ->link , ['%file ' => $ file , '%line ' => $ line ]);
116126 $ output [self ::FILES ][$ file ][] = [
117- self ::ERROR => $ this -> formatMessage ($ fileSpecificError ->getMessage ()),
127+ self ::ERROR => self :: formatMessage ($ fileSpecificError ->getMessage ()),
118128 self ::LINK => $ link ,
119129 self ::LINE => $ line ,
130+ self ::IGNORE => Neon::encode ($ fileSpecificError ->getMessage ()),
120131 ];
121132 }
122133
@@ -126,13 +137,12 @@ private function generateFile(AnalysisResult $analysisResult): void
126137 });
127138 }
128139 unset($ file );
129-
130140 }
131141
132142 FileSystem::write ($ this ->outputFile , $ this ->getTable ($ output ));
133143 }
134144
135- private function formatMessage (string $ message ): string
145+ private static function formatMessage (string $ message ): string
136146 {
137147 $ words = explode (' ' , $ message );
138148 $ words = array_map (function ($ word ) {
0 commit comments