@@ -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 |
@@ -64,7 +64,9 @@ |
||
64 | 64 | |
65 | 65 | $handler = $this->getHandler($provider, $parameters); |
66 | 66 | |
67 | - if ( $handler instanceof CacheInterface ) $manager->addProvider($handler); |
|
67 | + if ( $handler instanceof CacheInterface ) { |
|
68 | + $manager->addProvider($handler); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | } |
70 | 72 |
@@ -29,31 +29,31 @@ discard block |
||
29 | 29 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | 30 | */ |
31 | 31 | |
32 | -class DispatcherCache extends DispatcherClassModel{ |
|
32 | +class DispatcherCache extends DispatcherClassModel { |
|
33 | 33 | |
34 | 34 | public function init() { |
35 | 35 | |
36 | 36 | $cache = $this->configuration()->get('cache'); |
37 | 37 | |
38 | - if ( empty($cache) ) { |
|
38 | + if (empty($cache)) { |
|
39 | 39 | |
40 | 40 | $manager = new CacheManager(self::getAlgorithm(), $this->logger); |
41 | 41 | |
42 | 42 | } else { |
43 | 43 | |
44 | - $enabled = ( empty($cache['enabled']) || $cache['enabled'] === true ) ? true : false; |
|
44 | + $enabled = (empty($cache['enabled']) || $cache['enabled'] === true) ? true : false; |
|
45 | 45 | |
46 | - $algorithm = self::getAlgorithm( empty($cache['algorithm']) ? null : $cache['algorithm']); |
|
46 | + $algorithm = self::getAlgorithm(empty($cache['algorithm']) ? null : $cache['algorithm']); |
|
47 | 47 | |
48 | 48 | $manager = new CacheManager($algorithm, $this->logger); |
49 | 49 | |
50 | - if ( $enabled && !empty($cache['providers']) ) { |
|
50 | + if ($enabled && !empty($cache['providers'])) { |
|
51 | 51 | |
52 | 52 | foreach ($cache['providers'] as $provider => $parameters) { |
53 | 53 | |
54 | 54 | $handler = $this->getHandler($provider, $parameters); |
55 | 55 | |
56 | - if ( $handler instanceof CacheInterface ) $manager->addProvider($handler); |
|
56 | + if ($handler instanceof CacheInterface) $manager->addProvider($handler); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | |
81 | 81 | protected function getHandler($provider, $parameters) { |
82 | 82 | |
83 | - switch ( strtolower($parameters['type']) ) { |
|
83 | + switch (strtolower($parameters['type'])) { |
|
84 | 84 | |
85 | 85 | case 'file': |
86 | 86 | |
87 | 87 | $base = $this->configuration->get('base-path'); |
88 | 88 | |
89 | - if ( empty($parameters['folder']) || empty($base) ) { |
|
89 | + if (empty($parameters['folder']) || empty($base)) { |
|
90 | 90 | $this->logger->warning("Wrong cache provider, disabling $provider", $parameters); |
91 | 91 | break; |
92 | 92 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | case 'memcached': |
101 | 101 | |
102 | - if ( empty($parameters['host']) ) { |
|
102 | + if (empty($parameters['host'])) { |
|
103 | 103 | $this->logger->warning("Wrong cache provider, disabling $provider", $parameters); |
104 | 104 | break; |
105 | 105 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | protected static function getAlgorithm($algorithm = null) { |
134 | 134 | |
135 | - switch ( strtoupper($algorithm) ) { |
|
135 | + switch (strtoupper($algorithm)) { |
|
136 | 136 | |
137 | 137 | case 'PICK_LAST': |
138 | 138 | $selected = CacheManager::PICK_LAST; |
@@ -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 |