Conditions | 2 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
28 | public function guess($binary) |
||
29 | { |
||
30 | $tmpFile = tempnam(sys_get_temp_dir(), 'ht-img-module'); |
||
31 | |||
32 | try { |
||
33 | file_put_contents($tmpFile, $binary); |
||
34 | |||
35 | $mimeType = $this->mimeTypeGuesser->guess($tmpFile); |
||
36 | |||
37 | unlink($tmpFile); |
||
38 | |||
39 | return $mimeType; |
||
40 | } catch (\Exception $e) { |
||
41 | unlink($tmpFile); |
||
42 | |||
43 | throw $e; |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |