Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.0416 |
Changes | 0 |
1 | <?php |
||
20 | 4 | public function canConvert(Media $media): bool |
|
21 | { |
||
22 | 4 | if (!$this->requirementsAreInstalled()) { |
|
23 | return false; |
||
|
|||
24 | } |
||
25 | |||
26 | 4 | if (!$this->supportedExtensions()->contains(strtolower($media->getExtension()))) { |
|
27 | 1 | return false; |
|
28 | } |
||
29 | // $urlGenerator = UrlGeneratorFactory::createForMedia($media); |
||
30 | // if (method_exists($urlGenerator, 'getPath') && file_exists($media->getPath()) |
||
31 | // && $this->supportedMimetypes()->contains(strtolower(File::getMimetype($media->getPath())))) { |
||
32 | // return true; |
||
33 | // } |
||
34 | 3 | return true; |
|
35 | } |
||
79 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: