Conditions | 2 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
32 | 7 | public static function algoByName(string $name): CompressionAlgorithm |
|
33 | { |
||
34 | 7 | if (!array_key_exists($name, self::MAP_ALGO_TO_CLASS)) { |
|
35 | 1 | throw new \UnexpectedValueException( |
|
36 | 1 | "No compression algorithm '{$name}'."); |
|
37 | } |
||
38 | 6 | $cls = self::MAP_ALGO_TO_CLASS[$name]; |
|
39 | 6 | return new $cls(); |
|
40 | } |
||
59 |