Total Complexity | 9 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | trait TCheckCalls |
||
15 | { |
||
16 | use TLang; |
||
17 | |||
18 | /** |
||
19 | * @throws MimeException |
||
20 | */ |
||
21 | 4 | public function checkMimeClass(): void |
|
22 | { |
||
23 | 4 | if (!$this->isMimeClass()) { |
|
24 | // @codeCoverageIgnoreStart |
||
25 | throw new MimeException($this->getMiLang()->miNoClass()); |
||
26 | } |
||
27 | // @codeCoverageIgnoreEnd |
||
28 | } |
||
29 | |||
30 | 4 | public function isMimeClass(): bool |
|
31 | { |
||
32 | 4 | return class_exists('\finfo'); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @throws MimeException |
||
37 | */ |
||
38 | 6 | public function checkMimeMethod(): void |
|
39 | { |
||
40 | 6 | if (!$this->isMimeMethod()) { |
|
41 | // @codeCoverageIgnoreStart |
||
42 | throw new MimeException($this->getMiLang()->miNoMethod()); |
||
43 | } |
||
44 | // @codeCoverageIgnoreEnd |
||
45 | } |
||
46 | |||
47 | 11 | public function isMimeMethod(): bool |
|
48 | { |
||
49 | 11 | return method_exists('\finfo', 'buffer'); |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * @throws MimeException |
||
54 | */ |
||
55 | 13 | public function checkMimeFunction(): void |
|
56 | { |
||
57 | 13 | if (!$this->isMimeFunction()) { |
|
58 | // @codeCoverageIgnoreStart |
||
59 | throw new MimeException($this->getMiLang()->miNoFunction()); |
||
60 | } |
||
61 | // @codeCoverageIgnoreEnd |
||
62 | } |
||
63 | |||
64 | 25 | protected function isMimeFunction(): bool |
|
67 | } |
||
68 | } |
||
69 |