@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | public function set($code) { |
| 87 | 87 | |
| 88 | - if ( !array_key_exists($code, $this->http_status_codes) ) { |
|
| 88 | + if (!array_key_exists($code, $this->http_status_codes)) { |
|
| 89 | 89 | |
| 90 | 90 | throw new Exception("Invalid HTTP Status Code"); |
| 91 | 91 | |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function description($code=null) { |
|
| 100 | + public function description($code = null) { |
|
| 101 | 101 | |
| 102 | - if ( is_null($code) || !array_key_exists($code, $this->http_status_codes) ) { |
|
| 102 | + if (is_null($code) || !array_key_exists($code, $this->http_status_codes)) { |
|
| 103 | 103 | |
| 104 | 104 | $message = $this->http_status_codes[$this->status_code]; |
| 105 | 105 | |
@@ -128,20 +128,20 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | foreach ($decoded as $key => $string) { |
| 130 | 130 | |
| 131 | - $this->logger->debug("PARAMETER KEY: " . $key); |
|
| 131 | + $this->logger->debug("PARAMETER KEY: ".$key); |
|
| 132 | 132 | |
| 133 | - $this->logger->debug("PARAMETER STRING: " . $string); |
|
| 133 | + $this->logger->debug("PARAMETER STRING: ".$string); |
|
| 134 | 134 | |
| 135 | 135 | $param_regex .= $this->readparam($key, $string, $param_required); |
| 136 | 136 | |
| 137 | - $this->logger->debug("PARAMETER REGEX: " . $param_regex); |
|
| 137 | + $this->logger->debug("PARAMETER REGEX: ".$param_regex); |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $this->readpath( |
| 142 | 142 | $folders, |
| 143 | 143 | $value, |
| 144 | - $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?') |
|
| 144 | + $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?') |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $string = preg_replace('/(?<!\\)\((?!\?)/', '(?:', $string); |
| 185 | 185 | $string = preg_replace('/\.([\*\+])(?!\?)/', '.\${1}?', $string); |
| 186 | 186 | |
| 187 | - return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?'); |
|
| 187 | + return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?'); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -200,15 +200,15 @@ discard block |
||
| 200 | 200 | "query" => array() |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - $this->logger->debug("ROUTE: " . $route); |
|
| 203 | + $this->logger->debug("ROUTE: ".$route); |
|
| 204 | 204 | |
| 205 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
| 205 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
| 206 | 206 | |
| 207 | 207 | $regex = $this->readpath($folders, $value); |
| 208 | 208 | |
| 209 | - $this->logger->debug("ROUTE: " . $regex); |
|
| 209 | + $this->logger->debug("ROUTE: ".$regex); |
|
| 210 | 210 | |
| 211 | - $this->logger->debug("PARAMETERS: " . var_export($value, true)); |
|
| 211 | + $this->logger->debug("PARAMETERS: ".var_export($value, true)); |
|
| 212 | 212 | |
| 213 | 213 | $this->routes[$regex] = $value; |
| 214 | 214 | |
@@ -73,10 +73,11 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $regex = $this->readpath($folders); |
| 75 | 75 | |
| 76 | - if (isset($this->routes[$regex])) |
|
| 77 | - return $this->routes[$regex]; |
|
| 78 | - else |
|
| 79 | - return null; |
|
| 76 | + if (isset($this->routes[$regex])) { |
|
| 77 | + return $this->routes[$regex]; |
|
| 78 | + } else { |
|
| 79 | + return null; |
|
| 80 | + } |
|
| 80 | 81 | |
| 81 | 82 | } |
| 82 | 83 | |
@@ -86,7 +87,9 @@ discard block |
||
| 86 | 87 | |
| 87 | 88 | $regex = $this->readpath($folders); |
| 88 | 89 | |
| 89 | - if (isset($this->routes[$regex])) unset($this->routes[$regex]); |
|
| 90 | + if (isset($this->routes[$regex])) { |
|
| 91 | + unset($this->routes[$regex]); |
|
| 92 | + } |
|
| 90 | 93 | |
| 91 | 94 | } |
| 92 | 95 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $supported_methods = $this->configuration()->get('dispatcher-supported-methods'); |
| 96 | 96 | |
| 97 | - if ( method_exists($this, 'any') ) { |
|
| 97 | + if (method_exists($this, 'any')) { |
|
| 98 | 98 | |
| 99 | 99 | return $supported_methods; |
| 100 | 100 | |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $implemented_methods = array(); |
| 104 | 104 | |
| 105 | - foreach ( $supported_methods as $method ) { |
|
| 105 | + foreach ($supported_methods as $method) { |
|
| 106 | 106 | |
| 107 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
| 107 | + if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method); |
|
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | final public function getMethod($method) { |
| 120 | 120 | |
| 121 | - if ( method_exists($this, strtolower($method)) ) { |
|
| 121 | + if (method_exists($this, strtolower($method))) { |
|
| 122 | 122 | |
| 123 | 123 | return strtolower($method); |
| 124 | 124 | |
| 125 | - } else if ( method_exists($this, strtolower('any')) ) { |
|
| 125 | + } else if (method_exists($this, strtolower('any'))) { |
|
| 126 | 126 | |
| 127 | 127 | return 'any'; |
| 128 | 128 | |
@@ -104,7 +104,9 @@ |
||
| 104 | 104 | |
| 105 | 105 | foreach ( $supported_methods as $method ) { |
| 106 | 106 | |
| 107 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
| 107 | + if ( method_exists($this, strtolower($method)) ) { |
|
| 108 | + array_push($implemented_methods,$method); |
|
| 109 | + } |
|
| 108 | 110 | |
| 109 | 111 | } |
| 110 | 112 | |
@@ -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 | |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | final public function delete($property = null) { |
| 93 | 93 | |
| 94 | - if ( is_null($property) ) { |
|
| 94 | + if (is_null($property)) { |
|
| 95 | 95 | |
| 96 | 96 | $this->attributes = array(); |
| 97 | 97 | |
| 98 | 98 | return true; |
| 99 | 99 | |
| 100 | - } else if ( $this->isDefined($property) ) { |
|
| 100 | + } else if ($this->isDefined($property)) { |
|
| 101 | 101 | |
| 102 | 102 | unset($this->attributes[$property]); |
| 103 | 103 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function get($header = null) { |
| 31 | 31 | |
| 32 | - if ( is_null($header) ) return $this->headers; |
|
| 32 | + if (is_null($header)) return $this->headers; |
|
| 33 | 33 | |
| 34 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
| 34 | + else if (array_key_exists($header, $this->headers)) return $this->headers[$header]; |
|
| 35 | 35 | |
| 36 | 36 | else return null; |
| 37 | 37 | |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function getAsString($header = null) { |
| 41 | 41 | |
| 42 | - if ( is_null($header) ) { |
|
| 42 | + if (is_null($header)) { |
|
| 43 | 43 | |
| 44 | - return array_map( function($header, $value) { |
|
| 44 | + return array_map(function($header, $value) { |
|
| 45 | 45 | return (string)($header.':'.$value); |
| 46 | 46 | }, |
| 47 | 47 | $this->headers); |
| 48 | 48 | |
| 49 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
| 49 | + } else if (array_key_exists($header, $this->headers)) { |
|
| 50 | 50 | |
| 51 | 51 | return (string)($header.':'.$this->headers[$header]); |
| 52 | 52 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function set($header, $value=null) { |
|
| 57 | + public function set($header, $value = null) { |
|
| 58 | 58 | |
| 59 | - if ( is_null($value) ) { |
|
| 59 | + if (is_null($value)) { |
|
| 60 | 60 | |
| 61 | 61 | $header = explode(":", $header); |
| 62 | 62 | |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function delete($header = null) { |
| 76 | 76 | |
| 77 | - if ( is_null($header) ) { |
|
| 77 | + if (is_null($header)) { |
|
| 78 | 78 | |
| 79 | 79 | $this->headers = array(); |
| 80 | 80 | |
| 81 | 81 | return true; |
| 82 | 82 | |
| 83 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
| 83 | + } else if (array_key_exists($header, $this->headers)) { |
|
| 84 | 84 | |
| 85 | 85 | unset($this->headers[$header]); |
| 86 | 86 | |
@@ -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 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | final public function setTimestamp($time = null) { |
| 37 | 37 | |
| 38 | - if ( is_float($time) ) $this->timestamp = $time; |
|
| 38 | + if (is_float($time)) $this->timestamp = $time; |
|
| 39 | 39 | |
| 40 | 40 | else $this->timestamp = microtime(true); |
| 41 | 41 | |
@@ -35,9 +35,11 @@ |
||
| 35 | 35 | |
| 36 | 36 | final public function setTimestamp($time = null) { |
| 37 | 37 | |
| 38 | - if ( is_float($time) ) $this->timestamp = $time; |
|
| 39 | - |
|
| 40 | - else $this->timestamp = microtime(true); |
|
| 38 | + if ( is_float($time) ) { |
|
| 39 | + $this->timestamp = $time; |
|
| 40 | + } else { |
|
| 41 | + $this->timestamp = microtime(true); |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | return $this; |
| 43 | 45 | |