@@ -251,6 +251,9 @@ discard block |
||
251 | 251 | |
252 | 252 | } |
253 | 253 | |
254 | + /** |
|
255 | + * @param Router\Route $route |
|
256 | + */ |
|
254 | 257 | private function dumpCache($route) { |
255 | 258 | |
256 | 259 | $cache = strtoupper($route->getParameter('cache')); |
@@ -281,6 +284,9 @@ discard block |
||
281 | 284 | |
282 | 285 | } |
283 | 286 | |
287 | + /** |
|
288 | + * @param Router\Route $route |
|
289 | + */ |
|
284 | 290 | private function processConfigurationParameters($route) { |
285 | 291 | |
286 | 292 | $params = $route->getParameter('headers'); |
@@ -292,6 +298,9 @@ discard block |
||
292 | 298 | |
293 | 299 | } |
294 | 300 | |
301 | + /** |
|
302 | + * @param string $name |
|
303 | + */ |
|
295 | 304 | private function emitServiceSpecializedEvents($name) { |
296 | 305 | |
297 | 306 | $this->logger()->debug("Emitting $name service-event."); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->setTimestamp(); |
75 | 75 | |
76 | 76 | // parsing configuration |
77 | - $this->configuration = new Configuration( DefaultConfiguration::get() ); |
|
77 | + $this->configuration = new Configuration(DefaultConfiguration::get()); |
|
78 | 78 | |
79 | 79 | $this->configuration()->merge($configuration); |
80 | 80 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | |
154 | 154 | $this->logger()->debug("Emitting global dispatcher event."); |
155 | 155 | |
156 | - $this->events()->emit( new DispatcherEvent($this) ); |
|
156 | + $this->events()->emit(new DispatcherEvent($this)); |
|
157 | 157 | |
158 | - if ( $this->configuration()->get('enabled') === false ) { |
|
158 | + if ($this->configuration()->get('enabled') === false) { |
|
159 | 159 | |
160 | 160 | $this->logger()->debug("Dispatcher disabled, shutting down gracefully."); |
161 | 161 | |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request') ); |
|
174 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request')); |
|
175 | 175 | |
176 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get()) ); |
|
176 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.'.$this->request()->method()->get())); |
|
177 | 177 | |
178 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.request.#') ); |
|
178 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.request.#')); |
|
179 | 179 | |
180 | - if ( $this->readCache() ) { |
|
180 | + if ($this->readCache()) { |
|
181 | 181 | |
182 | 182 | return $this->shutdown(); |
183 | 183 | |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | |
206 | 206 | $this->logger()->debug("Route acquired, type $route_type directed to $route_service."); |
207 | 207 | |
208 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route') ); |
|
208 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route')); |
|
209 | 209 | |
210 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type) ); |
|
210 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_type)); |
|
211 | 211 | |
212 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service) ); |
|
212 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.'.$route_service)); |
|
213 | 213 | |
214 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.route.#') ); |
|
214 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.route.#')); |
|
215 | 215 | |
216 | 216 | // translate route to service |
217 | 217 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | |
240 | 240 | private function readCache() { |
241 | 241 | |
242 | - $name = (string) $this->request()->uri(); |
|
242 | + $name = (string)$this->request()->uri(); |
|
243 | 243 | |
244 | 244 | $cache = $this->cache()->setNamespace('dispatcher-service')->get($name); |
245 | 245 | |
246 | - if ( is_null($cache) ) return false; |
|
246 | + if (is_null($cache)) return false; |
|
247 | 247 | |
248 | 248 | $this->response = $cache; |
249 | 249 | |
@@ -255,25 +255,25 @@ discard block |
||
255 | 255 | |
256 | 256 | $cache = strtoupper($route->getParameter('cache')); |
257 | 257 | $ttl = $route->getParameter('ttl'); |
258 | - $name = (string) $this->request()->uri(); |
|
258 | + $name = (string)$this->request()->uri(); |
|
259 | 259 | |
260 | - if ( $cache == 'CLIENT' || $cache == 'BOTH' ) { |
|
260 | + if ($cache == 'CLIENT' || $cache == 'BOTH') { |
|
261 | 261 | |
262 | - if ( $ttl > 0 ) { |
|
262 | + if ($ttl > 0) { |
|
263 | 263 | |
264 | - $this->response()->headers()->set("Cache-Control","max-age=".$ttl.", must-revalidate"); |
|
265 | - $this->response()->headers()->set("Expires",gmdate("D, d M Y H:i:s", (int)$this->request()->getTimestamp() + $ttl)." GMT"); |
|
264 | + $this->response()->headers()->set("Cache-Control", "max-age=".$ttl.", must-revalidate"); |
|
265 | + $this->response()->headers()->set("Expires", gmdate("D, d M Y H:i:s", (int)$this->request()->getTimestamp()+$ttl)." GMT"); |
|
266 | 266 | |
267 | 267 | } else { |
268 | 268 | |
269 | - $this->response()->headers()->set("Cache-Control","no-cache, must-revalidate"); |
|
270 | - $this->response()->headers()->set("Expires","Mon, 26 Jul 1997 05:00:00 GMT"); |
|
269 | + $this->response()->headers()->set("Cache-Control", "no-cache, must-revalidate"); |
|
270 | + $this->response()->headers()->set("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); |
|
271 | 271 | |
272 | 272 | } |
273 | 273 | |
274 | 274 | } |
275 | 275 | |
276 | - if ( $cache == 'SERVER' || $cache == 'BOTH' ) { |
|
276 | + if ($cache == 'SERVER' || $cache == 'BOTH') { |
|
277 | 277 | |
278 | 278 | $this->cache()->setNamespace('dispatcher-service')->set($name, $this->response(), $ttl); |
279 | 279 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | $params = $route->getParameter('headers'); |
287 | 287 | |
288 | - if ( !empty($params) && is_array($params) ) { |
|
288 | + if (!empty($params) && is_array($params)) { |
|
289 | 289 | |
290 | - foreach($params as $name=>$value) $this->response()->headers()->set($name, $value); |
|
290 | + foreach ($params as $name=>$value) $this->response()->headers()->set($name, $value); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | } |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | |
327 | 327 | private function shutdown() { |
328 | 328 | |
329 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response') ); |
|
329 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response')); |
|
330 | 330 | |
331 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get()) ); |
|
331 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.'.$this->response()->status()->get())); |
|
332 | 332 | |
333 | - $this->events()->emit( $this->emitServiceSpecializedEvents('dispatcher.response.#') ); |
|
333 | + $this->events()->emit($this->emitServiceSpecializedEvents('dispatcher.response.#')); |
|
334 | 334 | |
335 | 335 | $this->logger()->debug("Composing return value."); |
336 | 336 |
@@ -243,7 +243,9 @@ discard block |
||
243 | 243 | |
244 | 244 | $cache = $this->cache()->setNamespace('dispatcher-service')->get($name); |
245 | 245 | |
246 | - if ( is_null($cache) ) return false; |
|
246 | + if ( is_null($cache) ) { |
|
247 | + return false; |
|
248 | + } |
|
247 | 249 | |
248 | 250 | $this->response = $cache; |
249 | 251 | |
@@ -287,7 +289,9 @@ discard block |
||
287 | 289 | |
288 | 290 | if ( !empty($params) && is_array($params) ) { |
289 | 291 | |
290 | - foreach($params as $name=>$value) $this->response()->headers()->set($name, $value); |
|
292 | + foreach($params as $name=>$value) { |
|
293 | + $this->response()->headers()->set($name, $value); |
|
294 | + } |
|
291 | 295 | } |
292 | 296 | |
293 | 297 | } |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | public function load($routes) { |
141 | 141 | |
142 | - if ( !empty($routes) ) { |
|
142 | + if (!empty($routes)) { |
|
143 | 143 | |
144 | - foreach( $routes as $name => $route ) { |
|
144 | + foreach ($routes as $name => $route) { |
|
145 | 145 | |
146 | 146 | $this->add($route['route'], $route['type'], $route['class'], $route['parameters']); |
147 | 147 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | private function readCache() { |
159 | 159 | |
160 | - if ( $this->configuration()->get('routing-table-cache') !== true ) return; |
|
160 | + if ($this->configuration()->get('routing-table-cache') !== true) return; |
|
161 | 161 | |
162 | 162 | $routes = $this->cache->setNamespace('dispatcher-internals')->get("dispatcher-routes"); |
163 | 163 | |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | private function dumpCache() { |
179 | 179 | |
180 | - if ( $this->configuration()->get('routing-table-cache') !== true ) return; |
|
180 | + if ($this->configuration()->get('routing-table-cache') !== true) return; |
|
181 | 181 | |
182 | 182 | $ttl = $this->configuration()->get('routing-table-ttl'); |
183 | 183 | |
184 | 184 | $routes = array(); |
185 | 185 | |
186 | - foreach($this->routes as $name => $route) { |
|
186 | + foreach ($this->routes as $name => $route) { |
|
187 | 187 | |
188 | 188 | $routes[$name] = $route->getData(); |
189 | 189 | |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | ->setClassName($class) // Class to be invoked |
205 | 205 | ->setParameters($parameters); // Parameters passed via the composer.json configuration (cache, ttl, etc...) |
206 | 206 | |
207 | - $this->logger->debug("ROUTE: " . implode("/", $folders)); |
|
207 | + $this->logger->debug("ROUTE: ".implode("/", $folders)); |
|
208 | 208 | |
209 | 209 | //$this->logger->debug("PARAMETERS: " . var_export($value, true)); |
210 | 210 | |
211 | 211 | // This method generate a global regular expression which will be able to match all the URI supported by the route |
212 | 212 | $regex = $this->parser->read($folders, $route); |
213 | 213 | |
214 | - $this->logger->debug("ROUTE: " . $regex); |
|
214 | + $this->logger->debug("ROUTE: ".$regex); |
|
215 | 215 | |
216 | 216 | //$this->logger->debug("PARAMETERS: " . var_export($value, true)); |
217 | 217 |
@@ -84,10 +84,11 @@ discard block |
||
84 | 84 | |
85 | 85 | $regex = $this->regex($route); |
86 | 86 | |
87 | - if (isset($this->routes[$regex])) |
|
88 | - return $this->routes[$regex]; |
|
89 | - else |
|
90 | - return null; |
|
87 | + if (isset($this->routes[$regex])) { |
|
88 | + return $this->routes[$regex]; |
|
89 | + } else { |
|
90 | + return null; |
|
91 | + } |
|
91 | 92 | |
92 | 93 | } |
93 | 94 | |
@@ -157,11 +158,15 @@ discard block |
||
157 | 158 | |
158 | 159 | private function readCache() { |
159 | 160 | |
160 | - if ( $this->configuration()->get('routing-table-cache') !== true ) return; |
|
161 | + if ( $this->configuration()->get('routing-table-cache') !== true ) { |
|
162 | + return; |
|
163 | + } |
|
161 | 164 | |
162 | 165 | $routes = $this->cache->setNamespace('dispatcher-internals')->get("dispatcher-routes"); |
163 | 166 | |
164 | - if (is_null($routes)) return; |
|
167 | + if (is_null($routes)) { |
|
168 | + return; |
|
169 | + } |
|
165 | 170 | |
166 | 171 | foreach ($routes as $name => $data) { |
167 | 172 | |
@@ -177,7 +182,9 @@ discard block |
||
177 | 182 | |
178 | 183 | private function dumpCache() { |
179 | 184 | |
180 | - if ( $this->configuration()->get('routing-table-cache') !== true ) return; |
|
185 | + if ( $this->configuration()->get('routing-table-cache') !== true ) { |
|
186 | + return; |
|
187 | + } |
|
181 | 188 | |
182 | 189 | $ttl = $this->configuration()->get('routing-table-ttl'); |
183 | 190 |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | |
109 | 109 | $methods = $this->configuration->get('allowed-http-methods'); |
110 | 110 | |
111 | - if ( ( $methods != null || !empty($methods) ) && in_array($method, $methods) === false ) { |
|
111 | + if (($methods != null || !empty($methods)) && in_array($method, $methods) === false) { |
|
112 | 112 | |
113 | 113 | throw new DispatcherException("Method not allowed", 0, null, 405, array( |
114 | - "Allow" => implode(",",$methods) |
|
114 | + "Allow" => implode(",", $methods) |
|
115 | 115 | )); |
116 | 116 | |
117 | 117 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | } |
140 | 140 | |
141 | - if ( $this->bypass_service ) { |
|
141 | + if ($this->bypass_service) { |
|
142 | 142 | |
143 | 143 | return; |
144 | 144 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | $methods = $service->getImplementedMethods(); |
160 | 160 | |
161 | - if ( in_array($method, $methods) ) { |
|
161 | + if (in_array($method, $methods)) { |
|
162 | 162 | |
163 | 163 | $callable = $service->getMethod($method); |
164 | 164 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | foreach ($this->table->routes() as $regex => $value) { |
202 | 202 | |
203 | 203 | // The current uri is checked against all the global regular expressions associated with the routes |
204 | - if (preg_match("/" . $regex . "/", $path, $matches)) { |
|
204 | + if (preg_match("/".$regex."/", $path, $matches)) { |
|
205 | 205 | |
206 | 206 | /* If a route is matched, all the bits of the route string are evalued in order to create |
207 | 207 | * new query parameters which will be available for the service class |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | private $response; |
74 | 74 | |
75 | - public function __construct(Configuration $configuration,LoggerInterface $logger, Response $response) { |
|
75 | + public function __construct(Configuration $configuration, LoggerInterface $logger, Response $response) { |
|
76 | 76 | |
77 | 77 | parent::__construct($configuration, $logger); |
78 | 78 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $output_class_name = "\\Comodojo\\Dispatcher\\Output\\HttpStatus\\Status".$status; |
88 | 88 | |
89 | - if ( class_exists($output_class_name) ) { |
|
89 | + if (class_exists($output_class_name)) { |
|
90 | 90 | |
91 | 91 | $output = new $output_class_name($this->response); |
92 | 92 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | $type = $this->response->content()->type(); |
124 | 124 | $charset = $this->response->content()->charset(); |
125 | 125 | |
126 | - if ( is_null($charset) ) { |
|
127 | - $this->response->headers()->set("Content-type",strtolower($type)); |
|
126 | + if (is_null($charset)) { |
|
127 | + $this->response->headers()->set("Content-type", strtolower($type)); |
|
128 | 128 | } else { |
129 | - $this->response->headers()->set("Content-type",strtolower($type)."; charset=".$charset); |
|
129 | + $this->response->headers()->set("Content-type", strtolower($type)."; charset=".$charset); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | $supported_methods = $this->configuration()->get('supported-http-methods'); |
98 | 98 | |
99 | - if ( is_null($supported_methods) ) $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT'); |
|
99 | + if (is_null($supported_methods)) $supported_methods = array('GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'TRACE', 'CONNECT'); |
|
100 | 100 | |
101 | - if ( method_exists($this, 'any') ) { |
|
101 | + if (method_exists($this, 'any')) { |
|
102 | 102 | |
103 | 103 | return $supported_methods; |
104 | 104 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | $implemented_methods = array(); |
108 | 108 | |
109 | - foreach ( $supported_methods as $method ) { |
|
109 | + foreach ($supported_methods as $method) { |
|
110 | 110 | |
111 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
111 | + if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getMethod($method) { |
124 | 124 | |
125 | - if ( method_exists($this, strtolower($method)) ) { |
|
125 | + if (method_exists($this, strtolower($method))) { |
|
126 | 126 | |
127 | 127 | return strtolower($method); |
128 | 128 | |
129 | - } else if ( method_exists($this, strtolower('any')) ) { |
|
129 | + } else if (method_exists($this, strtolower('any'))) { |
|
130 | 130 | |
131 | 131 | return 'any'; |
132 | 132 |
@@ -96,7 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | $supported_methods = $this->configuration()->get('supported-http-methods'); |
98 | 98 | |
99 | - if ( is_null($supported_methods) ) $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT'); |
|
99 | + if ( is_null($supported_methods) ) { |
|
100 | + $supported_methods = array('GET','PUT','POST','DELETE','OPTIONS','HEAD','TRACE','CONNECT'); |
|
101 | + } |
|
100 | 102 | |
101 | 103 | if ( method_exists($this, 'any') ) { |
102 | 104 | |
@@ -108,7 +110,9 @@ discard block |
||
108 | 110 | |
109 | 111 | foreach ( $supported_methods as $method ) { |
110 | 112 | |
111 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
113 | + if ( method_exists($this, strtolower($method)) ) { |
|
114 | + array_push($implemented_methods,$method); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | } |
114 | 118 |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | |
48 | 48 | if ( |
49 | 49 | empty($log) || |
50 | - ( isset($log['enabled']) && $log['enabled'] === false ) || |
|
50 | + (isset($log['enabled']) && $log['enabled'] === false) || |
|
51 | 51 | empty($log['providers']) |
52 | 52 | ) { |
53 | 53 | |
54 | 54 | $logger = new Logger('dispatcher'); |
55 | 55 | |
56 | - $logger->pushHandler( new NullHandler( self::getLevel() ) ); |
|
56 | + $logger->pushHandler(new NullHandler(self::getLevel())); |
|
57 | 57 | |
58 | 58 | } else { |
59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $handler = $this->getHandler($provider, $parameters); |
67 | 67 | |
68 | - if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler); |
|
68 | + if ($handler instanceof HandlerInterface) $logger->pushHandler($handler); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function getHandler($provider, $parameters) { |
94 | 94 | |
95 | - switch ( strtolower($parameters['type']) ) { |
|
95 | + switch (strtolower($parameters['type'])) { |
|
96 | 96 | |
97 | 97 | case 'StreamHandler': |
98 | 98 | |
99 | 99 | $stream = $this->configuration->get('base-path').'/'.(empty($parameters['stream']) ? 'dispatcher.log' : $parameters['stream']); |
100 | 100 | |
101 | - $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] ); |
|
101 | + $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']); |
|
102 | 102 | |
103 | - $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] ); |
|
103 | + $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']); |
|
104 | 104 | |
105 | - $filePermission = self::getFilePermission( empty($parameters['filePermission']) ? null : $parameters['filePermission'] ); |
|
105 | + $filePermission = self::getFilePermission(empty($parameters['filePermission']) ? null : $parameters['filePermission']); |
|
106 | 106 | |
107 | - $useLocking = self::getLocking( empty($parameters['useLocking']) ? false : $parameters['useLocking'] ); |
|
107 | + $useLocking = self::getLocking(empty($parameters['useLocking']) ? false : $parameters['useLocking']); |
|
108 | 108 | |
109 | 109 | $handler = new StreamHandler($stream, $level, $bubble, $filePermission, $useLocking); |
110 | 110 | |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | case 'SyslogHandler': |
114 | 114 | |
115 | - if ( empty($parameters['ident']) ) return null; |
|
115 | + if (empty($parameters['ident'])) return null; |
|
116 | 116 | |
117 | 117 | $facility = empty($parameters['facility']) ? LOG_USER : $parameters['facility']; |
118 | 118 | |
119 | - $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] ); |
|
119 | + $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']); |
|
120 | 120 | |
121 | - $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] ); |
|
121 | + $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']); |
|
122 | 122 | |
123 | 123 | $logopts = empty($parameters['logopts']) ? LOG_PID : $parameters['logopts']; |
124 | 124 | |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | |
131 | 131 | $messageType = empty($parameters['messageType']) ? ErrorLogHandler::OPERATING_SYSTEM : $parameters['messageType']; |
132 | 132 | |
133 | - $level = self::getLevel( empty($parameters['level']) ? null : $parameters['level'] ); |
|
133 | + $level = self::getLevel(empty($parameters['level']) ? null : $parameters['level']); |
|
134 | 134 | |
135 | - $bubble = self::getBubble( empty($parameters['bubble']) ? true : $parameters['bubble'] ); |
|
135 | + $bubble = self::getBubble(empty($parameters['bubble']) ? true : $parameters['bubble']); |
|
136 | 136 | |
137 | - $expandNewlines = self::getExpandNewlines( empty($parameters['expandNewlines']) ? false : $parameters['expandNewlines'] ); |
|
137 | + $expandNewlines = self::getExpandNewlines(empty($parameters['expandNewlines']) ? false : $parameters['expandNewlines']); |
|
138 | 138 | |
139 | 139 | $handler = new ErrorLogHandler($messageType, $level, $bubble, $expandNewlines); |
140 | 140 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected static function getLevel($level = null) { |
160 | 160 | |
161 | - switch ( strtoupper($level) ) { |
|
161 | + switch (strtoupper($level)) { |
|
162 | 162 | |
163 | 163 | case 'INFO': |
164 | 164 | $logger_level = Logger::INFO; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | protected static function getFilePermission($filepermission = null) { |
213 | 213 | |
214 | - if ( is_null($filepermission) ) return null; |
|
214 | + if (is_null($filepermission)) return null; |
|
215 | 215 | |
216 | 216 | return filter_var($bubble, FILTER_VALIDATE_INT, array( |
217 | 217 | 'options' => array( |
@@ -65,7 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | $handler = $this->getHandler($provider, $parameters); |
67 | 67 | |
68 | - if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler); |
|
68 | + if ( $handler instanceof HandlerInterface ) { |
|
69 | + $logger->pushHandler($handler); |
|
70 | + } |
|
69 | 71 | |
70 | 72 | } |
71 | 73 | |
@@ -112,7 +114,9 @@ discard block |
||
112 | 114 | |
113 | 115 | case 'SyslogHandler': |
114 | 116 | |
115 | - if ( empty($parameters['ident']) ) return null; |
|
117 | + if ( empty($parameters['ident']) ) { |
|
118 | + return null; |
|
119 | + } |
|
116 | 120 | |
117 | 121 | $facility = empty($parameters['facility']) ? LOG_USER : $parameters['facility']; |
118 | 122 | |
@@ -211,7 +215,9 @@ discard block |
||
211 | 215 | |
212 | 216 | protected static function getFilePermission($filepermission = null) { |
213 | 217 | |
214 | - if ( is_null($filepermission) ) return null; |
|
218 | + if ( is_null($filepermission) ) { |
|
219 | + return null; |
|
220 | + } |
|
215 | 221 | |
216 | 222 | return filter_var($bubble, FILTER_VALIDATE_INT, array( |
217 | 223 | 'options' => array( |
@@ -48,11 +48,11 @@ |
||
48 | 48 | |
49 | 49 | private static function urlGetAbsolute() { |
50 | 50 | |
51 | - $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://'; |
|
51 | + $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'; |
|
52 | 52 | |
53 | 53 | $uri = self::uriGetAbsolute(); |
54 | 54 | |
55 | - return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" ); |
|
55 | + return ($http.$_SERVER['HTTP_HOST'].$uri."/"); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 |