| @@ 100-111 (lines=12) @@ | ||
| 97 | $output = $config->reportFile; |
|
| 98 | } |
|
| 99 | ||
| 100 | if (strpos($type, '.') !== false) { |
|
| 101 | // This is a path to a custom report class. |
|
| 102 | $filename = realpath($type); |
|
| 103 | if ($filename === false) { |
|
| 104 | echo "ERROR: Custom report \"$type\" not found".PHP_EOL; |
|
| 105 | exit(2); |
|
| 106 | } |
|
| 107 | ||
| 108 | $reportClassName = Autoload::loadFile($filename); |
|
| 109 | } else { |
|
| 110 | $reportClassName = 'PHP_CodeSniffer\Reports\\'.$type; |
|
| 111 | } |
|
| 112 | ||
| 113 | $reportClass = new $reportClassName(); |
|
| 114 | if (false === ($reportClass instanceof Report)) { |
|
| @@ 127-140 (lines=14) @@ | ||
| 124 | ||
| 125 | if ($filterType === null) { |
|
| 126 | $filterClass = '\PHP_CodeSniffer\Filters\Filter'; |
|
| 127 | } else { |
|
| 128 | if (strpos($filterType, '.') !== false) { |
|
| 129 | // This is a path to a custom filter class. |
|
| 130 | $filename = realpath($filterType); |
|
| 131 | if ($filename === false) { |
|
| 132 | echo "ERROR: Custom filter \"$filterType\" not found".PHP_EOL; |
|
| 133 | exit(2); |
|
| 134 | } |
|
| 135 | ||
| 136 | $filterClass = \PHP_CodeSniffer\Autoload::loadFile($filename); |
|
| 137 | } else { |
|
| 138 | $filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | return $filterClass; |
|
| 143 | ||