@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | if (empty($allowed)) { |
| 126 | 126 | throw new \LogicException('Method not allowed.'); |
| 127 | 127 | } |
| 128 | - $values =& static::$values; |
|
| 128 | + $values = & static::$values; |
|
| 129 | 129 | if (array_key_exists($key, $values)) { |
| 130 | 130 | unset($values[$key]); |
| 131 | 131 | } else { |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public static function fixKeys() |
| 144 | 144 | { |
| 145 | - $values =& static::$values; |
|
| 145 | + $values = & static::$values; |
|
| 146 | 146 | |
| 147 | 147 | foreach ($values as $k => $v) { |
| 148 | 148 | $oldKey = $k; |
| 149 | 149 | if (!is_string($k)) { |
| 150 | 150 | if (!is_string($v)) { |
| 151 | - throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k,1), print_r($v,1))); |
|
| 151 | + throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k, 1), print_r($v, 1))); |
|
| 152 | 152 | } |
| 153 | 153 | // if the key is not a string, use the value if it is a string |
| 154 | 154 | $k = $v; |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | if (is_string($newValues)) { |
| 183 | 183 | $newValues = [$newValues => $newValues]; |
| 184 | 184 | } |
| 185 | - $values =& static::$values; |
|
| 185 | + $values = & static::$values; |
|
| 186 | 186 | foreach ($newValues as $k => $v) { |
| 187 | 187 | $oldKey = $k; |
| 188 | 188 | if (!is_string($k)) { |
| 189 | 189 | if (!is_string($v)) { |
| 190 | - throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k,1), print_r($v,1))); |
|
| 190 | + throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k, 1), print_r($v, 1))); |
|
| 191 | 191 | } |
| 192 | 192 | // if the key is not a string, use the value if it is a string |
| 193 | 193 | $k = $v; |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $caseSensitive = static::$caseSensitive; |
| 235 | 235 | } |
| 236 | 236 | if (empty($caseSensitive)) { |
| 237 | - $values = array_map(function($value){ |
|
| 237 | + $values = array_map(function($value) { |
|
| 238 | 238 | return strtoupper($value); |
| 239 | 239 | }, $values); |
| 240 | 240 | } |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | $keys = array_keys($values, $value); |
| 243 | 243 | $count = count($keys); |
| 244 | 244 | if (0 === $count) { |
| 245 | - throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value,1))); |
|
| 245 | + throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value, 1))); |
|
| 246 | 246 | } |
| 247 | 247 | return count($keys) > 1 ? $keys : $keys[0]; |
| 248 | 248 | } elseif (is_array($value)) { |
| 249 | 249 | $search = array_search($value, $values); |
| 250 | 250 | if (false === $search) { |
| 251 | - throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value,1))); |
|
| 251 | + throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value, 1))); |
|
| 252 | 252 | } |
| 253 | 253 | return $search; |
| 254 | 254 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $values = array_change_key_case($values, CASE_UPPER); |
| 308 | 308 | } |
| 309 | 309 | if (false === array_key_exists($key, $values)) { |
| 310 | - throw new \InvalidArgumentException(sprintf("Value for key '%s' does not exist.", print_r($key,1))); |
|
| 310 | + throw new \InvalidArgumentException(sprintf("Value for key '%s' does not exist.", print_r($key, 1))); |
|
| 311 | 311 | } |
| 312 | 312 | return $values[$key]; |
| 313 | 313 | } |
@@ -363,8 +363,7 @@ discard block |
||
| 363 | 363 | public function __isset($key) |
| 364 | 364 | { |
| 365 | 365 | return empty(static::$caseSensitive) ? |
| 366 | - array_key_exists(strtoupper($key), array_change_key_case(static::$values, CASE_UPPER)) : |
|
| 367 | - array_key_exists($key, static::$values); |
|
| 366 | + array_key_exists(strtoupper($key), array_change_key_case(static::$values, CASE_UPPER)) : array_key_exists($key, static::$values); |
|
| 368 | 367 | } |
| 369 | 368 | |
| 370 | 369 | |