@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected $attributes = array(); |
| 29 | 29 | |
| 30 | - public function __construct( $configuration = array() ) { |
|
| 30 | + public function __construct($configuration = array()) { |
|
| 31 | 31 | |
| 32 | 32 | $this->attributes = array_merge($this->attributes, $configuration); |
| 33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | final public function get($property = null) { |
| 37 | 37 | |
| 38 | - if ( is_null($property) ) { |
|
| 38 | + if (is_null($property)) { |
|
| 39 | 39 | |
| 40 | 40 | return $this->attributes; |
| 41 | 41 | |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $value = $this->attributes[$property]; |
| 45 | 45 | |
| 46 | - if ( is_scalar($value) && preg_match_all('/%(.+?)%/', $value, $matches) ) { |
|
| 46 | + if (is_scalar($value) && preg_match_all('/%(.+?)%/', $value, $matches)) { |
|
| 47 | 47 | |
| 48 | 48 | $substitutions = array(); |
| 49 | 49 | |
| 50 | - foreach ( $matches as $match ) { |
|
| 50 | + foreach ($matches as $match) { |
|
| 51 | 51 | |
| 52 | 52 | $backreference = $match[1]; |
| 53 | 53 | |
| 54 | - if ( $backreference != $property && !isset($substitutions['/%'.$backreference.'%/']) ) { |
|
| 54 | + if ($backreference != $property && !isset($substitutions['/%'.$backreference.'%/'])) { |
|
| 55 | 55 | |
| 56 | 56 | $substitutions['/%'.$backreference.'%/'] = $this->$backreference; |
| 57 | 57 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | final public function delete($property = null) { |
| 91 | 91 | |
| 92 | - if ( is_null($property) ) { |
|
| 92 | + if (is_null($property)) { |
|
| 93 | 93 | |
| 94 | 94 | $this->attributes = array(); |
| 95 | 95 | |
| 96 | 96 | return true; |
| 97 | 97 | |
| 98 | - } else if ( $this->isDefined($property) ) { |
|
| 98 | + } else if ($this->isDefined($property)) { |
|
| 99 | 99 | |
| 100 | 100 | unset($this->attributes[$property]); |
| 101 | 101 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | public function dispatch() { |
| 148 | 148 | |
| 149 | - $this->events->emit( new DispatcherEvent($this) ); |
|
| 149 | + $this->events->emit(new DispatcherEvent($this)); |
|
| 150 | 150 | |
| 151 | - if ( $this->configuration()->get('dispatcher-enabled') === false ) { |
|
| 151 | + if ($this->configuration()->get('dispatcher-enabled') === false) { |
|
| 152 | 152 | |
| 153 | 153 | $status = $this->configuration()->get('dispatcher-disabled-status'); |
| 154 | 154 | |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request') ); |
|
| 165 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request')); |
|
| 166 | 166 | |
| 167 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get()) ); |
|
| 167 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request->method()->get())); |
|
| 168 | 168 | |
| 169 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') ); |
|
| 169 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.request.#')); |
|
| 170 | 170 | |
| 171 | 171 | try { |
| 172 | 172 | |
@@ -174,21 +174,21 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | } catch (DispatcherException $de) { |
| 176 | 176 | |
| 177 | - $this->response()->status()->set( $de->getStatus() ); |
|
| 177 | + $this->response()->status()->set($de->getStatus()); |
|
| 178 | 178 | |
| 179 | - $this->response()->content()->set( $de->getMessage() ); |
|
| 179 | + $this->response()->content()->set($de->getMessage()); |
|
| 180 | 180 | |
| 181 | 181 | return $this->shutdown(); |
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route') ); |
|
| 185 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route')); |
|
| 186 | 186 | |
| 187 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType()) ); |
|
| 187 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getType())); |
|
| 188 | 188 | |
| 189 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService()) ); |
|
| 189 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$this->router->getService())); |
|
| 190 | 190 | |
| 191 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') ); |
|
| 191 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.route.#')); |
|
| 192 | 192 | |
| 193 | 193 | // translate route to service |
| 194 | 194 | |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | } catch (DispatcherException $de) { |
| 200 | 200 | |
| 201 | - $this->response()->status()->set( $de->getStatus() ); |
|
| 201 | + $this->response()->status()->set($de->getStatus()); |
|
| 202 | 202 | |
| 203 | - $this->response()->content()->set( $de->getMessage() ); |
|
| 203 | + $this->response()->content()->set($de->getMessage()); |
|
| 204 | 204 | |
| 205 | 205 | } |
| 206 | 206 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | private function shutdown() { |
| 225 | 225 | |
| 226 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response') ); |
|
| 226 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response')); |
|
| 227 | 227 | |
| 228 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get()) ); |
|
| 228 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response->status()->get())); |
|
| 229 | 229 | |
| 230 | - $this->events->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') ); |
|
| 230 | + $this->events->emit($this->emitServiceSpecializedEvents('dispatcher.response.#')); |
|
| 231 | 231 | |
| 232 | 232 | $return = Processor::parse($this->configuration, $this->logger, $this->response); |
| 233 | 233 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'dispatcher-log-level' => 'INFO', |
| 249 | 249 | 'dispatcher-log-target' => '%dispatcher-log-folder%/dispatcher.log', |
| 250 | 250 | 'dispatcher-log-folder' => '/log', |
| 251 | - 'dispatcher-supported-methods' => array('GET','PUT','POST','DELETE','OPTIONS','HEAD'), |
|
| 251 | + 'dispatcher-supported-methods' => array('GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD'), |
|
| 252 | 252 | 'dispatcher-default-encoding' => 'UTF-8', |
| 253 | 253 | 'dispatcher-cache-enabled' => true, |
| 254 | 254 | 'dispatcher-cache-ttl' => 3600, |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | private static function urlGetAbsolute() { |
| 266 | 266 | |
| 267 | - $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://'; |
|
| 267 | + $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'; |
|
| 268 | 268 | |
| 269 | 269 | $uri = preg_replace("/\/index.php(.*?)$/i", "", $_SERVER['PHP_SELF']); |
| 270 | 270 | |
| 271 | - return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" ); |
|
| 271 | + return ($http.$_SERVER['HTTP_HOST'].$uri."/"); |
|
| 272 | 272 | |
| 273 | 273 | } |
| 274 | 274 | |