Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | static public function create(Algorithm\AlgorithmInterface $algorithm) |
||
|
|||
14 | { |
||
15 | if ($algorithm instanceof Algorithm\AsymmetricInterface) { |
||
16 | $encryption = new Asymmetric($algorithm); |
||
17 | } elseif ($algorithm instanceof Algorithm\SymmetricInterface) { |
||
18 | $encryption = new Symmetric($algorithm); |
||
19 | } else { |
||
20 | throw new \InvalidArgumentException(sprintf( |
||
21 | 'Algorithm of class "%s" is neither symmetric or asymmetric.', |
||
22 | get_class($algorithm) |
||
23 | )); |
||
24 | } |
||
25 | |||
26 | return $encryption; |
||
27 | } |
||
28 | } |
||
29 |