Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
15 | 5 | public function createDecryptor($fileName) |
|
16 | { |
||
17 | 5 | $className = 'Tartana\\Component\\Decrypter\\' . ucfirst(strtolower(pathinfo($fileName, PATHINFO_EXTENSION))); |
|
18 | |||
19 | // Check if the class exists for the host to download |
||
20 | 5 | if (!class_exists($className)) { |
|
21 | 2 | return null; |
|
22 | } |
||
23 | |||
24 | 3 | $decrypter = new $className(); |
|
25 | 3 | if (!$decrypter instanceof DecrypterInterface) { |
|
26 | 1 | return null; |
|
27 | } |
||
28 | |||
29 | 2 | $decrypter->setLogger($this->getLogger()); |
|
30 | |||
31 | 2 | return $decrypter; |
|
32 | } |
||
33 | } |
||
34 |