Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| SignatureSniffer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| doDetect | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace ImageMimeTypeGuesser\Detectors; |
| 4 | |
| 5 | use \ImageMimeTypeGuesser\Detectors\AbstractDetector; |
| 6 | use \ImageMimeTypeSniffer\ImageMimeTypeSniffer; |
| 7 | |
| 8 | class SignatureSniffer extends AbstractDetector |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * Try to detect mime type by sniffing the first four bytes. |
| 13 | * |
| 14 | * Returns: |
| 15 | * - mime type (string) (if it is in fact an image, and type could be determined) |
| 16 | * - false (if it is not an image type that the server knowns about) |
| 17 | * - null (if nothing can be determined) |
| 18 | * |
| 19 | * @param string $filePath The path to the file |
| 20 | * @return string|false|null mimetype (if it is an image, and type could be determined), |
| 21 | * false (if it is not an image type that the server knowns about) |
| 22 | * or null (if nothing can be determined) |
| 23 | */ |
| 24 | protected function doDetect($filePath) |
| 25 | { |
| 26 | return ImageMimeTypeSniffer::detect($filePath); |
| 27 | } |
| 28 | } |