| Conditions | 7 |
| Paths | 7 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 13.125 |
| Changes | 0 | ||
| 1 | <?php |
||
| 99 | 2 | private function normolizeValue(string $string) |
|
| 100 | { |
||
| 101 | 2 | if (empty($string)) { |
|
| 102 | return ''; |
||
| 103 | } |
||
| 104 | |||
| 105 | 2 | if ('null' === $string) { |
|
| 106 | return null; |
||
| 107 | } |
||
| 108 | |||
| 109 | 2 | if (!preg_match('/[^0-9.]+/', $string)) { |
|
| 110 | if (preg_match('/[.]+/', $string)) { |
||
| 111 | return (float)$string; |
||
| 112 | } |
||
| 113 | |||
| 114 | return (int)$string; |
||
| 115 | } |
||
| 116 | |||
| 117 | 2 | if ('true' === $string) { |
|
| 118 | return true; |
||
| 119 | } |
||
| 120 | |||
| 121 | 2 | if ('false' === $string) { |
|
| 122 | return false; |
||
| 123 | } |
||
| 124 | |||
| 125 | 2 | return (string)$string; |
|
| 126 | } |
||
| 127 | } |
||
| 128 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.