1 | <?php |
||
14 | class ConflictsCommand extends AbstractRewriteCommand |
||
15 | { |
||
16 | protected function configure() |
||
17 | { |
||
18 | $this |
||
19 | ->setName('dev:module:rewrite:conflicts') |
||
20 | ->addOption( |
||
21 | 'log-junit', |
||
22 | null, |
||
23 | InputOption::VALUE_REQUIRED, |
||
24 | 'Log conflicts in JUnit XML format to defined file.' |
||
25 | ) |
||
26 | ->setDescription('Lists all magento rewrite conflicts'); |
||
27 | |||
28 | $help = <<<HELP |
||
29 | Lists all duplicated rewrites and tells you which class is loaded by Magento. |
||
30 | The command checks class inheritance in order of your module dependencies. |
||
31 | |||
32 | * If a filename with `--log-junit` option is set the tool generates an XML file and no output to *stdout*. |
||
33 | |||
34 | Exit status is 0 if no conflicts were found, 1 if conflicts were found and 2 if there was a problem to |
||
35 | initialize Magento. |
||
36 | HELP; |
||
37 | $this->setHelp($help); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param InputInterface $input |
||
42 | * @param OutputInterface $output |
||
43 | * |
||
44 | * @return int exit code: 0 no conflicts found, 1 conflicts found, 2 magento could not be initialized |
||
45 | */ |
||
46 | protected function execute(InputInterface $input, OutputInterface $output) |
||
84 | |||
85 | /** |
||
86 | * Returns loaded class by type like models or blocks |
||
87 | * |
||
88 | * @param string $type |
||
89 | * @param string $class |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function _getLoadedClass($type, $class) |
||
107 | |||
108 | /** |
||
109 | * @param array $conflicts |
||
110 | * @param string $filename |
||
111 | * @param float $duration |
||
112 | */ |
||
113 | protected function logJUnit(array $conflicts, $filename, $duration) |
||
137 | |||
138 | /** |
||
139 | * Check if rewritten class has inherited the parent class. |
||
140 | * If yes we have no conflict. The top class can extend every core class. |
||
141 | * So we cannot check this. |
||
142 | * |
||
143 | * @var array $classes |
||
144 | * @return bool |
||
145 | */ |
||
146 | protected function _isInheritanceConflict(array $classes) |
||
168 | |||
169 | /** |
||
170 | * @param OutputInterface $output |
||
171 | * @param array $conflicts |
||
172 | * @return int |
||
173 | */ |
||
174 | private function writeOutput(OutputInterface $output, array $conflicts) |
||
194 | } |
||
195 |