1 | <?php |
||
19 | final class Application |
||
20 | { |
||
21 | /** |
||
22 | * @var SniffDispatcher |
||
23 | */ |
||
24 | private $sniffDispatcher; |
||
25 | |||
26 | /** |
||
27 | * @var FilesProvider |
||
28 | */ |
||
29 | private $filesProvider; |
||
30 | |||
31 | /** |
||
32 | * @var SniffSetFactory |
||
33 | */ |
||
34 | private $sniffSetFactory; |
||
35 | |||
36 | /** |
||
37 | * @var ExcludedSniffDataCollector |
||
38 | */ |
||
39 | private $excludedSniffDataCollector; |
||
40 | |||
41 | /** |
||
42 | * @var ConfigurationResolver |
||
43 | */ |
||
44 | private $configurationResolver; |
||
45 | |||
46 | /** |
||
47 | * @var FileProcessor |
||
48 | */ |
||
49 | private $fileProcessor; |
||
50 | |||
51 | 1 | public function __construct( |
|
68 | |||
69 | 1 | public function runCommand(RunApplicationCommand $command) |
|
70 | { |
||
71 | 1 | $command = $this->resolveCommandConfiguration($command); |
|
72 | |||
73 | 1 | $this->excludedSniffDataCollector->addExcludedSniffs($command->getExcludedSniffs()); |
|
74 | |||
75 | 1 | $this->createAndRegisterSniffsToSniffDispatcher($command->getStandards(), $command->getSniffs()); |
|
76 | |||
77 | 1 | $this->runForSource($command->getSource(), $command->isFixer()); |
|
78 | 1 | } |
|
79 | |||
80 | 1 | private function createAndRegisterSniffsToSniffDispatcher(array $standards, array $extraSniffs) |
|
85 | |||
86 | 1 | private function runForSource(array $source, bool $isFixer) |
|
87 | { |
||
88 | 1 | $files = $this->filesProvider->getFilesForSource($source, $isFixer); |
|
89 | 1 | $this->fileProcessor->processFiles($files, $isFixer); |
|
90 | 1 | } |
|
91 | |||
92 | 1 | private function resolveCommandConfiguration(RunApplicationCommand $command) : RunApplicationCommand |
|
102 | } |
||
103 |