@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if (empty($allowed)) { |
| 115 | 115 | throw new \LogicException('Method not allowed.'); |
| 116 | 116 | } |
| 117 | - $values =& static::$values; |
|
| 117 | + $values = & static::$values; |
|
| 118 | 118 | if (array_key_exists($key, $values)) { |
| 119 | 119 | unset($values[$key]); |
| 120 | 120 | } else { |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | public static function fixKeys(array $values = []) |
| 136 | 136 | { |
| 137 | 137 | if (empty($values)) { |
| 138 | - $values =& static::$values; |
|
| 138 | + $values = & static::$values; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | foreach ($values as $k => $v) { |
| 142 | 142 | $oldKey = $k; |
| 143 | 143 | if (!is_string($k)) { |
| 144 | 144 | if (!is_string($v)) { |
| 145 | - throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k,1), print_r($v,1))); |
|
| 145 | + throw new \UnexpectedValueException(sprintf("Key '%s' for value '%s' is not a string!", print_r($k, 1), print_r($v, 1))); |
|
| 146 | 146 | } |
| 147 | 147 | // if the key is not a string, use the value if it is a string |
| 148 | 148 | $k = $v; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | throw new \LogicException('Overwrite not allowed.'); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $values =& static::$values; |
|
| 178 | + $values = & static::$values; |
|
| 179 | 179 | |
| 180 | 180 | // if it's a string, convert to array |
| 181 | 181 | if (is_string($newValues)) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $caseSensitive = static::$caseSensitive; |
| 225 | 225 | } |
| 226 | 226 | if (empty($caseSensitive)) { |
| 227 | - $values = array_map(function($value){ |
|
| 227 | + $values = array_map(function($value) { |
|
| 228 | 228 | return strtoupper($value); |
| 229 | 229 | }, $values); |
| 230 | 230 | } |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | $keys = array_keys($values, $value); |
| 233 | 233 | $count = count($keys); |
| 234 | 234 | if (0 === $count) { |
| 235 | - throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value,1))); |
|
| 235 | + throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value, 1))); |
|
| 236 | 236 | } |
| 237 | 237 | return count($keys) > 1 ? $keys : $keys[0]; |
| 238 | 238 | } elseif (is_array($value)) { |
| 239 | 239 | $search = array_search($value, $values); |
| 240 | 240 | if (false === $search) { |
| 241 | - throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value,1))); |
|
| 241 | + throw new \InvalidArgumentException(sprintf("Key for value '%s' does not exist.", print_r($value, 1))); |
|
| 242 | 242 | } |
| 243 | 243 | return $search; |
| 244 | 244 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $values = array_change_key_case($values, CASE_UPPER); |
| 298 | 298 | } |
| 299 | 299 | if (false === array_key_exists($key, $values)) { |
| 300 | - throw new \InvalidArgumentException(sprintf("Value for key '%s' does not exist.", print_r($key,1))); |
|
| 300 | + throw new \InvalidArgumentException(sprintf("Value for key '%s' does not exist.", print_r($key, 1))); |
|
| 301 | 301 | } |
| 302 | 302 | return $values[$key]; |
| 303 | 303 | } |
@@ -353,8 +353,7 @@ discard block |
||
| 353 | 353 | public function __isset($key) |
| 354 | 354 | { |
| 355 | 355 | return empty(static::$caseSensitive) ? |
| 356 | - array_key_exists(strtoupper($key), array_change_key_case(static::$values, CASE_UPPER)) : |
|
| 357 | - array_key_exists($key, static::$values); |
|
| 356 | + array_key_exists(strtoupper($key), array_change_key_case(static::$values, CASE_UPPER)) : array_key_exists($key, static::$values); |
|
| 358 | 357 | } |
| 359 | 358 | |
| 360 | 359 | |