| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 21 | public static function getType($type) |
|
| 28 | { |
||
| 29 | 21 | $string_pattern = static::getStringPattern(); |
|
| 30 | 21 | $int_pattern = '/.*int(?:eger)?\(\d+\).*/i'; |
|
| 31 | 21 | $float_pattern = static::getFloatPattern(); |
|
| 32 | |||
| 33 | switch (1) { |
||
| 34 | 21 | case preg_match($string_pattern, $type): |
|
| 35 | 10 | return Type::STRING; |
|
| 36 | 11 | case preg_match($int_pattern, $type): |
|
| 37 | 5 | return Type::INT; |
|
| 38 | 6 | case preg_match($float_pattern, $type): |
|
| 39 | 5 | return Type::FLOAT; |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | throw new \RuntimeException('Unknown data type'); |
|
| 43 | } |
||
| 75 |