44
55namespace SavinMikhail \CommentsDensity \AnalyzeComments \Commands ;
66
7- use RecursiveDirectoryIterator ;
8- use RecursiveIteratorIterator ;
97use SavinMikhail \CommentsDensity \AnalyzeComments \Analyzer \AnalyzerFactory ;
108use SavinMikhail \CommentsDensity \AnalyzeComments \Config \ConfigLoader ;
119use SavinMikhail \CommentsDensity \AnalyzeComments \Config \DTO \HtmlOutputDTO ;
1210use SavinMikhail \CommentsDensity \AnalyzeComments \Formatter \ConsoleFormatter ;
1311use SavinMikhail \CommentsDensity \AnalyzeComments \Formatter \HtmlFormatter ;
1412use SavinMikhail \CommentsDensity \Baseline \Storage \TreePhpBaselineStorage ;
15- use SplFileInfo ;
1613use Symfony \Component \Console \Command \Command ;
1714use Symfony \Component \Console \Input \InputInterface ;
1815use Symfony \Component \Console \Output \OutputInterface ;
@@ -42,7 +39,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4239 $ this ->storage ->init ($ path );
4340
4441 $ configDto = $ this ->configLoader ->getConfigDto ();
45- $ files = $ this ->getFilesFromDirectories ($ configDto ->directories );
4642
4743 $ formatters = ['console ' => new ConsoleFormatter ($ output )];
4844 if ($ configDto ->output instanceof HtmlOutputDTO) {
@@ -52,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5248
5349 $ analyzer = $ this ->analyzerFactory ->getAnalyzer ($ configDto , $ this ->storage );
5450
55- $ report = $ analyzer ->analyze ($ files );
51+ $ report = $ analyzer ->analyze ();
5652
5753 $ formatter ->report ($ report );
5854
@@ -65,18 +61,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6561
6662 return Command::SUCCESS ;
6763 }
68-
69- /**
70- * @param string[] $directories
71- * @return SplFileInfo[]
72- */
73- protected function getFilesFromDirectories (array $ directories ): iterable
74- {
75- foreach ($ directories as $ directory ) {
76- $ iterator = new RecursiveIteratorIterator (new RecursiveDirectoryIterator ($ directory ));
77- foreach ($ iterator as $ file ) {
78- yield $ file ;
79- }
80- }
81- }
8264}
0 commit comments