@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | protected $dispatcher; |
| 31 | 31 | |
| 32 | - public function __construct( Dispatcher $dispatcher ) { |
|
| 32 | + public function __construct(Dispatcher $dispatcher) { |
|
| 33 | 33 | |
| 34 | 34 | parent::__construct('dispatcher'); |
| 35 | 35 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function get($header = null) { |
| 30 | 30 | |
| 31 | - if ( is_null($header) ) return $this->headers; |
|
| 31 | + if (is_null($header)) return $this->headers; |
|
| 32 | 32 | |
| 33 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
| 33 | + else if (array_key_exists($header, $this->headers)) return $this->headers[$header]; |
|
| 34 | 34 | |
| 35 | 35 | else return null; |
| 36 | 36 | |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function getAsString($header = null) { |
| 40 | 40 | |
| 41 | - if ( is_null($header) ) { |
|
| 41 | + if (is_null($header)) { |
|
| 42 | 42 | |
| 43 | - return array_map( [$this, 'headerToString'], |
|
| 43 | + return array_map([$this, 'headerToString'], |
|
| 44 | 44 | array_keys($this->headers), |
| 45 | 45 | array_values($this->headers) |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
| 48 | + } else if (array_key_exists($header, $this->headers)) { |
|
| 49 | 49 | |
| 50 | 50 | return self::headerToString($header, $this->headers[$header]); |
| 51 | 51 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function set($header, $value=null) { |
|
| 56 | + public function set($header, $value = null) { |
|
| 57 | 57 | |
| 58 | - if ( is_null($value) ) { |
|
| 58 | + if (is_null($value)) { |
|
| 59 | 59 | |
| 60 | 60 | $header = explode(":", $header); |
| 61 | 61 | |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function delete($header = null) { |
| 75 | 75 | |
| 76 | - if ( is_null($header) ) { |
|
| 76 | + if (is_null($header)) { |
|
| 77 | 77 | |
| 78 | 78 | $this->headers = array(); |
| 79 | 79 | |
| 80 | 80 | return true; |
| 81 | 81 | |
| 82 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
| 82 | + } else if (array_key_exists($header, $this->headers)) { |
|
| 83 | 83 | |
| 84 | 84 | unset($this->headers[$header]); |
| 85 | 85 | |
@@ -29,11 +29,13 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function get($header = null) { |
| 31 | 31 | |
| 32 | - if ( is_null($header) ) return $this->headers; |
|
| 33 | - |
|
| 34 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
| 35 | - |
|
| 36 | - else return null; |
|
| 32 | + if ( is_null($header) ) { |
|
| 33 | + return $this->headers; |
|
| 34 | + } else if ( array_key_exists($header, $this->headers) ) { |
|
| 35 | + return $this->headers[$header]; |
|
| 36 | + } else { |
|
| 37 | + return null; |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | } |
| 39 | 41 | |
@@ -50,7 +52,9 @@ discard block |
||
| 50 | 52 | |
| 51 | 53 | return (string)($header.':'.$this->headers[$header]); |
| 52 | 54 | |
| 53 | - } else return null; |
|
| 55 | + } else { |
|
| 56 | + return null; |
|
| 57 | + } |
|
| 54 | 58 | |
| 55 | 59 | } |
| 56 | 60 | |
@@ -47,7 +47,9 @@ |
||
| 47 | 47 | |
| 48 | 48 | $cache_object = $this->cache->setNamespace('dispatcherservice')->get($name); |
| 49 | 49 | |
| 50 | - if ( is_null($cache_object) ) return false; |
|
| 50 | + if ( is_null($cache_object) ) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | $response->import($cache); |
| 53 | 55 | |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | Response $response |
| 42 | 42 | ) { |
| 43 | 43 | |
| 44 | - $name = md5( (string) $request->method . (string) $request->uri ); |
|
| 44 | + $name = md5((string)$request->method.(string)$request->uri); |
|
| 45 | 45 | |
| 46 | 46 | $cache_object = $this->cache->setNamespace('dispatcherservice')->get($name); |
| 47 | 47 | |
| 48 | - if ( is_null($cache_object) ) return false; |
|
| 48 | + if (is_null($cache_object)) return false; |
|
| 49 | 49 | |
| 50 | 50 | $response->import($cache_object); |
| 51 | 51 | |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $ttl = $route->getParameter('ttl'); |
| 65 | 65 | |
| 66 | - $name = md5( (string) $request->method . (string) $request->uri ); |
|
| 66 | + $name = md5((string)$request->method.(string)$request->uri); |
|
| 67 | 67 | |
| 68 | 68 | $method = $request->method->get(); |
| 69 | 69 | |
| 70 | 70 | $status = $response->status->get(); |
| 71 | 71 | |
| 72 | 72 | if ( |
| 73 | - ( $cache == 'SERVER' || $cache == 'BOTH' ) && |
|
| 73 | + ($cache == 'SERVER' || $cache == 'BOTH') && |
|
| 74 | 74 | in_array($method, self::$cachable_methods) && |
| 75 | 75 | in_array($status, self::$cachable_statuses) |
| 76 | - ){ |
|
| 76 | + ) { |
|
| 77 | 77 | |
| 78 | 78 | $this->cache |
| 79 | 79 | ->setNamespace('dispatcherservice') |