| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| 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 | $process = new Process('vendor/allocine/twigcs/bin/twigcs lint ' . $file); |
||
| 35 | $process->setWorkingDirectory($parameters['root_directory']); |
||
| 36 | $process->run(); |
||
| 37 | |||
| 38 | if (!$process->isSuccessful()) { |
||
| 39 | $errors[] = new Error( |
||
| 40 | $file, |
||
| 41 | sprintf('<error>%s</error>', trim($process->getErrorOutput())), |
||
| 42 | sprintf('<error>%s</error>', trim($process->getOutput())) |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return $errors; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |