Conditions | 3 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
34 | 2 | private function transform($value, $type) |
|
35 | { |
||
36 | 2 | $type = strtolower($type); |
|
37 | 2 | $type = 'boolean' === $type ? 'bool' : $type; |
|
38 | 2 | $function = $type.'val'; |
|
39 | |||
40 | 2 | if (function_exists($function)) { |
|
41 | 1 | return $function($value); |
|
42 | } |
||
43 | |||
44 | 1 | throw InvalidArgumentException::invalidType($type, $function); |
|
45 | } |
||
47 |