| Conditions | 4 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function check(array $files = [], array $parameters = null) |
||
| 27 | { |
||
| 28 | $errors = []; |
||
| 29 | foreach ($files as $file) { |
||
| 30 | if (false === self::exist($file, $parameters['twigcs_path'], 'twig')) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | |||
| 34 | $processBuilder = new ProcessBuilder(['php', 'vendor/allocine/twigcs/bin/twigcs lint', $file]); |
||
| 35 | $processBuilder->setWorkingDirectory($parameters['root_directory']); |
||
| 36 | $process = $processBuilder->getProcess(); |
||
| 37 | $process->run(); |
||
| 38 | |||
| 39 | if (!$process->isSuccessful()) { |
||
| 40 | $errors[] = new Error( |
||
| 41 | $file, |
||
| 42 | sprintf('<error>%s</error>', trim($process->getErrorOutput())), |
||
| 43 | sprintf('<error>%s</error>', trim($process->getOutput())) |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return $errors; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |