| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | private static function sniffFile($file, $standards) |
||
| 42 | { |
||
| 43 | $command = COMPOSER_VENDOR_DIR . '/bin/phpcs'; |
||
| 44 | |||
| 45 | $command .= " --standard={$standards}"; |
||
| 46 | |||
| 47 | $command .= ' --report=json'; |
||
| 48 | |||
| 49 | $command .= " $file"; |
||
| 50 | |||
| 51 | $command = escapeshellcmd($command); |
||
| 52 | |||
| 53 | // Run phpcs and grab the output. |
||
| 54 | exec($command, $output); |
||
| 55 | |||
| 56 | if (is_null($output)) { |
||
| 57 | return null; |
||
| 58 | } |
||
| 59 | |||
| 60 | $result = json_decode(reset($output)); |
||
| 61 | |||
| 62 | return $result->files; |
||
| 63 | } |
||
| 64 | } |
||
| 65 |