Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 4 | protected function doDetect($filePath) |
|
21 | { |
||
22 | $detectors = [ |
||
23 | 4 | 'FInfo', |
|
24 | 'SniffFirstFourBytes', |
||
25 | 'ExifImageType', |
||
26 | //'GetImageSize', // Disabled, as documentation says it is unreliable |
||
27 | 'MimeContentType', |
||
28 | ]; |
||
29 | |||
30 | 4 | foreach ($detectors as $className) { |
|
31 | 4 | $result = call_user_func( |
|
32 | 4 | array("\\ImageMimeTypeGuesser\\Detectors\\" . $className, 'detect'), |
|
33 | $filePath |
||
34 | ); |
||
35 | 4 | if (!is_null($result)) { |
|
36 | 4 | return $result; |
|
37 | } |
||
38 | } |
||
39 | |||
40 | return null; // undetermined |
||
41 | } |
||
43 |