88use Symplify \EasyCodingStandard \Console \Style \EasyCodingStandardStyle ;
99use Symplify \EasyCodingStandard \Contract \Console \Output \OutputFormatterInterface ;
1010use Symplify \EasyCodingStandard \Error \ErrorAndDiffCollector ;
11+ use Symplify \EasyCodingStandard \ValueObject \Error \ErrorAndDiffResult ;
1112use Symplify \PackageBuilder \Console \ShellCode ;
1213
1314final class SummaryOnlyOutputFormatter implements OutputFormatterInterface
@@ -39,13 +40,13 @@ public function __construct(
3940 ) {
4041 $ this ->easyCodingStandardStyle = $ easyCodingStandardStyle ;
4142 $ this ->configuration = $ configuration ;
42- $ this -> errorAndDiffCollector = $ errorAndDiffCollector ;
43+ $ errorAndDiffResult = $ errorAndDiffCollector ;
4344 }
4445
45- public function report (int $ processedFilesCount ): int
46+ public function report (ErrorAndDiffResult $ errorAndDiffResult , int $ processedFilesCount ): int
4647 {
47- if ($ this -> errorAndDiffCollector ->getErrorCount () === 0
48- && $ this -> errorAndDiffCollector ->getFileDiffsCount () === 0
48+ if ($ errorAndDiffResult ->getErrorCount () === 0
49+ && $ errorAndDiffResult ->getFileDiffsCount () === 0
4950 ) {
5051 if ($ processedFilesCount !== 0 ) {
5152 $ this ->easyCodingStandardStyle ->newLine ();
@@ -58,53 +59,53 @@ public function report(int $processedFilesCount): int
5859
5960 $ this ->easyCodingStandardStyle ->newLine ();
6061
61- return $ this ->configuration ->isFixer () ? $ this ->printAfterFixerStatus () : $ this ->printNoFixerStatus ();
62+ return $ this ->configuration ->isFixer () ? $ this ->printAfterFixerStatus ($ errorAndDiffResult ) : $ this ->printNoFixerStatus ($ errorAndDiffResult );
6263 }
6364
6465 public function getName (): string
6566 {
6667 return self ::NAME ;
6768 }
6869
69- private function printAfterFixerStatus (): int
70+ private function printAfterFixerStatus (ErrorAndDiffResult $ errorAndDiffResult ): int
7071 {
7172 if ($ this ->configuration ->shouldShowErrorTable ()) {
72- $ this ->easyCodingStandardStyle ->printErrors ($ this -> errorAndDiffCollector ->getErrors ());
73+ $ this ->easyCodingStandardStyle ->printErrors ($ errorAndDiffResult ->getErrors ());
7374 }
7475
75- if ($ this -> errorAndDiffCollector ->getErrorCount () === 0 ) {
76+ if ($ errorAndDiffResult ->getErrorCount () === 0 ) {
7677 $ this ->easyCodingStandardStyle ->success (
7778 sprintf (
7879 '%d error%s successfully fixed and no other found! ' ,
79- $ this -> errorAndDiffCollector ->getFileDiffsCount (),
80- $ this -> errorAndDiffCollector ->getFileDiffsCount () === 1 ? '' : 's '
80+ $ errorAndDiffResult ->getFileDiffsCount (),
81+ $ errorAndDiffResult ->getFileDiffsCount () === 1 ? '' : 's '
8182 )
8283 );
8384
8485 return ShellCode::SUCCESS ;
8586 }
8687
8788 $ this ->printErrorMessageFromErrorCounts (
88- $ this -> errorAndDiffCollector ->getErrorCount (),
89- $ this -> errorAndDiffCollector ->getFileDiffsCount ()
89+ $ errorAndDiffResult ->getErrorCount (),
90+ $ errorAndDiffResult ->getFileDiffsCount ()
9091 );
9192
9293 return ShellCode::ERROR ;
9394 }
9495
95- private function printNoFixerStatus (): int
96+ private function printNoFixerStatus (ErrorAndDiffResult $ errorAndDiffResult ): int
9697 {
9798 if ($ this ->configuration ->shouldShowErrorTable ()) {
98- $ errors = $ this -> errorAndDiffCollector ->getErrors ();
99+ $ errors = $ errorAndDiffResult ->getErrors ();
99100 if (count ($ errors ) > 0 ) {
100101 $ this ->easyCodingStandardStyle ->newLine ();
101102 $ this ->easyCodingStandardStyle ->printErrors ($ errors );
102103 }
103104 }
104105
105106 $ this ->printErrorMessageFromErrorCounts (
106- $ this -> errorAndDiffCollector ->getErrorCount (),
107- $ this -> errorAndDiffCollector ->getFileDiffsCount ()
107+ $ errorAndDiffResult ->getErrorCount (),
108+ $ errorAndDiffResult ->getFileDiffsCount ()
108109 );
109110
110111 return ShellCode::ERROR ;
0 commit comments