@@ -91,7 +91,7 @@ |
||
| 91 | 91 | $newValue = []; |
| 92 | 92 | |
| 93 | 93 | foreach ($value as $key => $val) { |
| 94 | - $newValue[ camelcase($key) ] = $val; |
|
| 94 | + $newValue[camelcase($key)] = $val; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | parent::offsetSet(camelcase($offset), new self($newValue)); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * WITH TRAILING SLASH! |
| 30 | 30 | */ |
| 31 | -if (!defined('PATH_KERNEL')) { |
|
| 31 | +if ( ! defined('PATH_KERNEL')) { |
|
| 32 | 32 | define('PATH_KERNEL', __DIR__ . DIRECTORY_SEPARATOR); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $get[$property] = $property; |
| 147 | 147 | |
| 148 | 148 | if (isset($this->{$property})) { |
| 149 | - $get[$property] =& $this->{$property}; |
|
| 149 | + $get[$property] = & $this->{$property}; |
|
| 150 | 150 | } elseif ($this->services->has($property)) { |
| 151 | 151 | $get[$property] = $this->services->get($property); |
| 152 | 152 | } |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | { |
| 156 | 156 | $arguments = array_values($arguments); |
| 157 | 157 | array_unshift($arguments, null); |
| 158 | - unset($arguments[ 0 ]); |
|
| 158 | + unset($arguments[0]); |
|
| 159 | 159 | |
| 160 | 160 | $this->requestMethodArgs = $arguments; |
| 161 | 161 | |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | $this->path = $path; |
| 77 | 77 | $this->closure = $closure; |
| 78 | 78 | $this->domain = is_null($domain) |
| 79 | - ? isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 80 | - ? @$_SERVER[ 'HTTP_HOST' ] |
|
| 81 | - : @$_SERVER[ 'SERVER_NAME' ] |
|
| 79 | + ? isset($_SERVER['HTTP_HOST']) |
|
| 80 | + ? @$_SERVER['HTTP_HOST'] |
|
| 81 | + : @$_SERVER['SERVER_NAME'] |
|
| 82 | 82 | : $domain; |
| 83 | 83 | |
| 84 | 84 | // Remove www |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (preg_match_all("/{(.*)}/", $this->domain, $matches)) { |
| 90 | - foreach ($matches[ 1 ] as $match) { |
|
| 90 | + foreach ($matches[1] as $match) { |
|
| 91 | 91 | $this->closureParameters[] = $match; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | public function isValidDomain() |
| 148 | 148 | { |
| 149 | - $domain = isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 150 | - ? $_SERVER[ 'HTTP_HOST' ] |
|
| 151 | - : $_SERVER[ 'SERVER_NAME' ]; |
|
| 149 | + $domain = isset($_SERVER['HTTP_HOST']) |
|
| 150 | + ? $_SERVER['HTTP_HOST'] |
|
| 151 | + : $_SERVER['SERVER_NAME']; |
|
| 152 | 152 | |
| 153 | 153 | if ($this->domain === $domain) { |
| 154 | 154 | return true; |
@@ -179,22 +179,22 @@ discard block |
||
| 179 | 179 | if (($class = $parameter->getClass()) instanceof \ReflectionClass) { |
| 180 | 180 | $className = $class->getName(); |
| 181 | 181 | if (class_exists($className)) { |
| 182 | - if (isset($matches[ $parameter->name ])) { |
|
| 183 | - $parameters[ $index ] = new $className($matches[ $parameter->name ]); |
|
| 182 | + if (isset($matches[$parameter->name])) { |
|
| 183 | + $parameters[$index] = new $className($matches[$parameter->name]); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | - } elseif (isset($matches[ $parameter->name ])) { |
|
| 187 | - $parameters[ $index ] = $matches[ $parameter->name ]; |
|
| 186 | + } elseif (isset($matches[$parameter->name])) { |
|
| 187 | + $parameters[$index] = $matches[$parameter->name]; |
|
| 188 | 188 | } else { |
| 189 | - $parameters[ $index ] = null; |
|
| 189 | + $parameters[$index] = null; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } else { |
| 193 | 193 | foreach ($closure->getParameters() as $index => $parameter) { |
| 194 | - if (isset($matches[ $index ])) { |
|
| 195 | - $parameters[ $index ] = $matches[ $index ]; |
|
| 194 | + if (isset($matches[$index])) { |
|
| 195 | + $parameters[$index] = $matches[$index]; |
|
| 196 | 196 | } else { |
| 197 | - $parameters[ $index ] = null; |
|
| 197 | + $parameters[$index] = null; |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | $parameters = []; |
| 240 | 240 | |
| 241 | 241 | for ($i = 0; $i <= count($pathParts); $i++) { |
| 242 | - if (isset($pathParts[ $i ]) && isset($stringParts[ $i ])) { |
|
| 243 | - if ($pathParts[ $i ] == $stringParts[ $i ]) { |
|
| 244 | - $matches[ $i ] = $stringParts[ $i ]; |
|
| 242 | + if (isset($pathParts[$i]) && isset($stringParts[$i])) { |
|
| 243 | + if ($pathParts[$i] == $stringParts[$i]) { |
|
| 244 | + $matches[$i] = $stringParts[$i]; |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if (isset($pathParts[ $i ])) { |
|
| 249 | - if (preg_match("/{(.*)}/", $pathParts[ $i ])) { |
|
| 250 | - $index = str_replace(['{$', '}'], '', $pathParts[ $i ]); |
|
| 251 | - $parameters[ $index ] = isset($stringParts[ $i ]) ? $stringParts[ $i ] : null; |
|
| 248 | + if (isset($pathParts[$i])) { |
|
| 249 | + if (preg_match("/{(.*)}/", $pathParts[$i])) { |
|
| 250 | + $index = str_replace(['{$', '}'], '', $pathParts[$i]); |
|
| 251 | + $parameters[$index] = isset($stringParts[$i]) ? $stringParts[$i] : null; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | $path = '/' . ltrim($path, '/'); |
| 143 | 143 | $translations = $this->getTranslations($domain); |
| 144 | 144 | |
| 145 | - if (isset($translations[ $path ])) { |
|
| 146 | - return $translations[ $path ]; |
|
| 145 | + if (isset($translations[$path])) { |
|
| 146 | + return $translations[$path]; |
|
| 147 | 147 | } elseif (count($translations)) { |
| 148 | 148 | foreach ($translations as $translation => $action) { |
| 149 | 149 | if ($action->isValidUriString($path)) { |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $translations = []; |
| 179 | 179 | |
| 180 | - if (isset($this->translations[ $domain ])) { |
|
| 181 | - $translations = $this->translations[ $domain ]; |
|
| 180 | + if (isset($this->translations[$domain])) { |
|
| 181 | + $translations = $this->translations[$domain]; |
|
| 182 | 182 | } else { |
| 183 | 183 | $domain = new Domain($domain); |
| 184 | 184 | if (array_key_exists($domain->getString(), $this->translations)) { |
| 185 | - $translations = $this->translations[ $domain->getString() ]; |
|
| 185 | + $translations = $this->translations[$domain->getString()]; |
|
| 186 | 186 | } else { |
| 187 | 187 | foreach ($this->translations as $domainRoute => $domainMap) { |
| 188 | 188 | if (preg_match('/[{][a-zA-Z0-9$_]+[}]/', $domainRoute)) { |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | if ($domain->getParentDomain() === $domainRoute->getParentDomain() AND |
| 192 | 192 | $domain->getTotalSubDomains() == $domainRoute->getTotalSubDomains() |
| 193 | 193 | ) { |
| 194 | - if (isset($domainMap[ $domainRoute->getSubDomain() ])) { |
|
| 194 | + if (isset($domainMap[$domainRoute->getSubDomain()])) { |
|
| 195 | 195 | $translations = $domainMap; |
| 196 | - $address = $translations[ $domainRoute->getSubDomain() ]->setClosureParameters( |
|
| 196 | + $address = $translations[$domainRoute->getSubDomain()]->setClosureParameters( |
|
| 197 | 197 | $domain->getSubDomains() |
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | - unset($translations[ $domainRoute->getSubDomain() ]); |
|
| 200 | + unset($translations[$domainRoute->getSubDomain()]); |
|
| 201 | 201 | |
| 202 | 202 | if (false !== ($closureParameters = $address->getClosure())) { |
| 203 | 203 | |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | } else { |
| 251 | 251 | |
| 252 | 252 | if (is_string($address)) { |
| 253 | - $namespace = isset($this->attributes[ 'namespace' ]) |
|
| 254 | - ? $this->attributes[ 'namespace' ] |
|
| 253 | + $namespace = isset($this->attributes['namespace']) |
|
| 254 | + ? $this->attributes['namespace'] |
|
| 255 | 255 | : null; |
| 256 | 256 | $controllerClassName = trim($namespace, '\\') . '\\' . $address; |
| 257 | 257 | |
@@ -260,17 +260,17 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $closure = function () use ($address) { |
|
| 263 | + $closure = function() use ($address) { |
|
| 264 | 264 | return $address; |
| 265 | 265 | }; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $domain = isset($this->attributes[ 'domain' ]) |
|
| 269 | - ? $this->attributes[ 'domain' ] |
|
| 268 | + $domain = isset($this->attributes['domain']) |
|
| 269 | + ? $this->attributes['domain'] |
|
| 270 | 270 | : null; |
| 271 | 271 | |
| 272 | - $prefix = isset($this->attributes[ 'prefix' ]) |
|
| 273 | - ? $this->attributes[ 'prefix' ] |
|
| 272 | + $prefix = isset($this->attributes['prefix']) |
|
| 273 | + ? $this->attributes['prefix'] |
|
| 274 | 274 | : null; |
| 275 | 275 | |
| 276 | 276 | if ( ! preg_match('/[{][a-zA-Z0-9$_]+[}]/', $path)) { |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $action = new Datastructures\Action($method, $path, $closure, $domain); |
| 281 | 281 | |
| 282 | - $this->translations[ $action->getDomain() ][ $action->getPath() ] = $action; |
|
| 282 | + $this->translations[$action->getDomain()][$action->getPath()] = $action; |
|
| 283 | 283 | |
| 284 | 284 | return $this; |
| 285 | 285 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $hostDomain = new Domain(); |
| 325 | 325 | $domainParts = explode('.', $domain); |
| 326 | 326 | |
| 327 | - if(count($domainParts) == 1) { |
|
| 327 | + if (count($domainParts) == 1) { |
|
| 328 | 328 | $domain = $domain . '.' . $hostDomain->getParentDomain(); |
| 329 | 329 | } else { |
| 330 | 330 | $domain = str_replace('.' . $hostDomain->getParentDomain(), '', |
@@ -332,26 +332,26 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - $this->domains[ $domain ] = $address; |
|
| 335 | + $this->domains[$domain] = $address; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | public function getDomain($domain = null) |
| 339 | 339 | { |
| 340 | 340 | $domain = is_null($domain) |
| 341 | - ? isset($_SERVER[ 'HTTP_HOST' ]) |
|
| 342 | - ? $_SERVER[ 'HTTP_HOST' ] |
|
| 343 | - : $_SERVER[ 'SERVER_NAME' ] |
|
| 341 | + ? isset($_SERVER['HTTP_HOST']) |
|
| 342 | + ? $_SERVER['HTTP_HOST'] |
|
| 343 | + : $_SERVER['SERVER_NAME'] |
|
| 344 | 344 | : $domain; |
| 345 | 345 | |
| 346 | 346 | if (array_key_exists($domain, $this->domains)) { |
| 347 | - if (is_callable($this->domains[ $domain ])) { |
|
| 348 | - return call_user_func($this->domains[ $domain ]); |
|
| 347 | + if (is_callable($this->domains[$domain])) { |
|
| 348 | + return call_user_func($this->domains[$domain]); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - return $this->domains[ $domain ]; |
|
| 352 | - } elseif (isset($this->domains[ '*' ]) and is_callable($this->domains[ '*' ])) { |
|
| 351 | + return $this->domains[$domain]; |
|
| 352 | + } elseif (isset($this->domains['*']) and is_callable($this->domains['*'])) { |
|
| 353 | 353 | // check wildcard domain closure |
| 354 | - if (false !== ($address = call_user_func($this->domains[ '*' ], $domain))) { |
|
| 354 | + if (false !== ($address = call_user_func($this->domains['*'], $domain))) { |
|
| 355 | 355 | return $address; |
| 356 | 356 | } |
| 357 | 357 | } elseif (count($this->domains)) { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $extension = ltrim($mimeType, '.'); |
| 242 | 242 | // Is this extension supported? |
| 243 | 243 | if (isset($mimes[$extension])) { |
| 244 | - $mimeType =& $mimes[$extension]; |
|
| 244 | + $mimeType = & $mimes[$extension]; |
|
| 245 | 245 | if (is_array($mimeType)) { |
| 246 | 246 | $mimeType = current($mimeType); |
| 247 | 247 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | if ($this->mimeType === 'application/json') { |
| 402 | - if (!empty($data)) { |
|
| 402 | + if ( ! empty($data)) { |
|
| 403 | 403 | array_push($response['result'], $data); |
| 404 | 404 | } |
| 405 | 405 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $xml->addAttribute('status', $statusCode); |
| 410 | 410 | $xml->addAttribute('reason', $reasonPhrase); |
| 411 | 411 | |
| 412 | - if (!empty($data)) { |
|
| 412 | + if ( ! empty($data)) { |
|
| 413 | 413 | $this->arrayToXml(['message' => $data], $xml); |
| 414 | 414 | } |
| 415 | 415 | echo $xml->asXML(); |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getOption($name, $default = null) |
| 50 | 50 | { |
| 51 | - if ( ! isset($this->options[ $name ])) { |
|
| 51 | + if ( ! isset($this->options[$name])) { |
|
| 52 | 52 | return $default; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - return $this->options[ $name ]; |
|
| 55 | + return $this->options[$name]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setOption($name, $value) |
| 67 | 67 | { |
| 68 | - $this->options[ $name ] = $value; |
|
| 68 | + $this->options[$name] = $value; |
|
| 69 | 69 | |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function hasHeader($name) |
| 144 | 144 | { |
| 145 | - return (bool)isset($this->headers[ $name ]); |
|
| 145 | + return (bool)isset($this->headers[$name]); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // ------------------------------------------------------------------------ |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getHeaderLine($name) |
| 173 | 173 | { |
| 174 | - if (isset($this->headers[ $name ])) { |
|
| 175 | - $this->headers[ $name ]; |
|
| 174 | + if (isset($this->headers[$name])) { |
|
| 175 | + $this->headers[$name]; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | return ''; |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | $lines = []; |
| 235 | 235 | |
| 236 | - if (isset($this->headers[ $name ])) { |
|
| 237 | - $lines = array_map('trim', explode(',', $this->headers[ $name ])); |
|
| 236 | + if (isset($this->headers[$name])) { |
|
| 237 | + $lines = array_map('trim', explode(',', $this->headers[$name])); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $lines; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | public function withHeader($name, $value) |
| 264 | 264 | { |
| 265 | 265 | $message = clone $this; |
| 266 | - $message->headers[ $name ] = $value; |
|
| 266 | + $message->headers[$name] = $value; |
|
| 267 | 267 | |
| 268 | 268 | return $message; |
| 269 | 269 | } |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $message = clone $this; |
| 291 | 291 | |
| 292 | - if (isset($message->headers[ $name ])) { |
|
| 293 | - unset($message->headers[ $name ]); |
|
| 292 | + if (isset($message->headers[$name])) { |
|
| 293 | + unset($message->headers[$name]); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | return $message; |
@@ -33,13 +33,13 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function &__get($property) |
| 35 | 35 | { |
| 36 | - $get[ $property ] = false; |
|
| 36 | + $get[$property] = false; |
|
| 37 | 37 | |
| 38 | 38 | if (services()->has($property)) { |
| 39 | - $get[ $property ] = services()->get($property); |
|
| 39 | + $get[$property] = services()->get($property); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - return $get[ $property ]; |
|
| 42 | + return $get[$property]; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // ------------------------------------------------------------------------ |