| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 4 | public function load($path) |
|
| 34 | { |
||
| 35 | try { |
||
| 36 | 4 | $contents = $this->filesystem->read($path); |
|
|
|
|||
| 37 | 1 | } catch (FileNotFoundException $e) { |
|
| 38 | 1 | throw new Exception\ImageNotFoundException(sprintf('Source image not found in "%s"', $path)); |
|
| 39 | } |
||
| 40 | |||
| 41 | try { |
||
| 42 | 3 | $mimeType = $this->filesystem->mimeType($path); |
|
| 43 | 1 | } catch (\LogicException $e) { |
|
| 44 | // Mime Type could not be detected |
||
| 45 | 1 | return $contents; |
|
| 46 | } |
||
| 47 | |||
| 48 | 2 | if (!$mimeType) { |
|
| 49 | // Mime Type could not be detected |
||
| 50 | 1 | return $contents; |
|
| 51 | } |
||
| 52 | |||
| 53 | 1 | return new Binary($contents, $mimeType); |
|
| 54 | } |
||
| 55 | } |
||
| 56 |