@@ -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 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | 'encoding' => 'UTF-8', |
| 31 | 31 | 'disabled-status' => 503, |
| 32 | 32 | 'disabled-message' => 'Dispatcher offline', |
| 33 | - 'supported-methods' => array('GET','PUT','POST','DELETE','OPTIONS','HEAD') |
|
| 33 | + 'supported-methods' => array('GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD') |
|
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | public static function get() { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | private static function urlGetAbsolute() { |
| 49 | 49 | |
| 50 | - $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://'; |
|
| 50 | + $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://'; |
|
| 51 | 51 | |
| 52 | 52 | $uri = preg_replace("/\/index.php(.*?)$/i", "", $_SERVER['PHP_SELF']); |
| 53 | 53 | |
| 54 | - return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" ); |
|
| 54 | + return ($http.$_SERVER['HTTP_HOST'].$uri."/"); |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | if ( |
| 47 | 47 | empty($log) || |
| 48 | - ( isset($log['enabled']) && $log['enabled'] === false ) || |
|
| 48 | + (isset($log['enabled']) && $log['enabled'] === false) || |
|
| 49 | 49 | empty($log['providers']) |
| 50 | 50 | ) {
|
| 51 | 51 | |
| 52 | 52 | $logger = new Logger('dispatcher');
|
| 53 | 53 | |
| 54 | - $logger->pushHandler( new NullHandler( self::getLevel() ) ); |
|
| 54 | + $logger->pushHandler(new NullHandler(self::getLevel())); |
|
| 55 | 55 | |
| 56 | 56 | } else {
|
| 57 | 57 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $handler = $this->getHandler($provider, $parameters); |
| 65 | 65 | |
| 66 | - if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler); |
|
| 66 | + if ($handler instanceof HandlerInterface) $logger->pushHandler($handler); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | protected function getHandler($provider, $parameters) {
|
| 92 | 92 | |
| 93 | - switch ( strtolower($parameters['type']) ) {
|
|
| 93 | + switch (strtolower($parameters['type'])) {
|
|
| 94 | 94 | |
| 95 | 95 | case 'streamhandler': |
| 96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $file = $this->configuration->get('base-path').'/'.$target;
|
| 100 | 100 | |
| 101 | - $level = self::getLevel( empty($parameters['level']) ? 'info' : $parameters['level'] ); |
|
| 101 | + $level = self::getLevel(empty($parameters['level']) ? 'info' : $parameters['level']); |
|
| 102 | 102 | |
| 103 | 103 | $handler = new StreamHandler($file, $level); |
| 104 | 104 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | protected static function getLevel($level = null) {
|
| 124 | 124 | |
| 125 | - switch ( strtoupper($level) ) {
|
|
| 125 | + switch (strtoupper($level)) {
|
|
| 126 | 126 | |
| 127 | 127 | case 'INFO': |
| 128 | 128 | $logger_level = Logger::INFO; |
@@ -63,7 +63,9 @@ |
||
| 63 | 63 | |
| 64 | 64 | $handler = $this->getHandler($provider, $parameters); |
| 65 | 65 | |
| 66 | - if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler); |
|
| 66 | + if ( $handler instanceof HandlerInterface ) { |
|
| 67 | + $logger->pushHandler($handler); |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | } |
| 69 | 71 | |
@@ -30,11 +30,11 @@ |
||
| 30 | 30 | |
| 31 | 31 | $last_modified = $this->response()->headers()->get('Last-Modified'); |
| 32 | 32 | |
| 33 | - if ( is_null($last_modified) ) { |
|
| 33 | + if (is_null($last_modified)) { |
|
| 34 | 34 | |
| 35 | 35 | header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); |
| 36 | 36 | |
| 37 | - } else if ( is_int($last_modified) ) { |
|
| 37 | + } else if (is_int($last_modified)) { |
|
| 38 | 38 | |
| 39 | 39 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304); |
| 40 | 40 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | header($_SERVER["SERVER_PROTOCOL"].' 204 No Content'); |
| 32 | 32 | header('Status: 204 No Content'); |
| 33 | - header('Content-Length: 0',true); |
|
| 33 | + header('Content-Length: 0', true); |
|
| 34 | 34 | |
| 35 | 35 | $this->response()->content()->set(null); |
| 36 | 36 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function consolidate() { |
| 30 | 30 | |
| 31 | - header("Location: ".$this->response()->location()->get(),true,$this->response()->status()->get()); |
|
| 31 | + header("Location: ".$this->response()->location()->get(), true, $this->response()->status()->get()); |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | // An Allow Header should be prvided from DispatcherException |
| 32 | 32 | $allowed = $this->response()->headers()->get('Allow'); |
| 33 | 33 | |
| 34 | - if ( is_null($allowed) ) { |
|
| 34 | + if (is_null($allowed)) { |
|
| 35 | 35 | |
| 36 | 36 | header('Method not allowed', true, 405); |
| 37 | 37 | |
@@ -86,7 +86,7 @@ |
||
| 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 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | // An Allow Header should be prvided from DispatcherException |
| 32 | 32 | $allowed = $this->response()->headers()->get('Allow'); |
| 33 | 33 | |
| 34 | - if ( is_null($allowed) ) { |
|
| 34 | + if (is_null($allowed)) { |
|
| 35 | 35 | |
| 36 | 36 | header('Method not allowed', true, 405); |
| 37 | 37 | |