@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | final 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 | |
37 | 37 | } |
38 | 38 | |
39 | - final public function set($header, $value=null) { |
|
39 | + final public function set($header, $value = null) { |
|
40 | 40 | |
41 | - if ( is_null($value) ) { |
|
41 | + if (is_null($value)) { |
|
42 | 42 | |
43 | 43 | $header = explode(":", $header); |
44 | 44 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | final public function unset($header = null) { |
58 | 58 | |
59 | - if ( is_null($header) ) { |
|
59 | + if (is_null($header)) { |
|
60 | 60 | |
61 | 61 | $this->headers = array(); |
62 | 62 | |
63 | 63 | return true; |
64 | 64 | |
65 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
65 | + } else if (array_key_exists($header, $this->headers)) { |
|
66 | 66 | |
67 | 67 | unset($this->headers[$header]); |
68 | 68 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | |
27 | 27 | protected $parameters = array(); |
28 | 28 | |
29 | - final public function get($parameter=null) { |
|
29 | + final public function get($parameter = null) { |
|
30 | 30 | |
31 | - if ( is_null($parameter) ) return $this->parameters; |
|
31 | + if (is_null($parameter)) return $this->parameters; |
|
32 | 32 | |
33 | - else if ( array_key_exists($parameter, $this->parameters) ) { |
|
33 | + else if (array_key_exists($parameter, $this->parameters)) { |
|
34 | 34 | |
35 | 35 | return $this->parameters[$parameter]; |
36 | 36 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | final public function unset($parameter = null) { |
52 | 52 | |
53 | - if ( is_null($parameter) ) { |
|
53 | + if (is_null($parameter)) { |
|
54 | 54 | |
55 | 55 | $this->parameters = array(); |
56 | 56 | |
57 | 57 | return true; |
58 | 58 | |
59 | - } else if ( array_key_exists($parameter, $this->parameters) ) { |
|
59 | + } else if (array_key_exists($parameter, $this->parameters)) { |
|
60 | 60 | |
61 | 61 | unset($this->parameters[$parameter]); |
62 | 62 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | header($_SERVER["SERVER_PROTOCOL"].' 204 No Content'); |
110 | 110 | header('Status: 204 No Content'); |
111 | - header('Content-Length: 0',true); |
|
111 | + header('Content-Length: 0', true); |
|
112 | 112 | |
113 | 113 | $return = null; |
114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | case 303: //See Other |
121 | 121 | case 307: //Temporary Redirect |
122 | 122 | |
123 | - header("Location: ".$location->get(),true,$status); |
|
123 | + header("Location: ".$location->get(), true, $status); |
|
124 | 124 | |
125 | 125 | break; |
126 | 126 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | |
129 | 129 | $last_modified = $headers->get('Last-Modified'); |
130 | 130 | |
131 | - if ( is_null($last_modified) ) { |
|
131 | + if (is_null($last_modified)) { |
|
132 | 132 | |
133 | 133 | header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); |
134 | 134 | |
135 | - } else if ( is_int($last_modified) ) { |
|
135 | + } else if (is_int($last_modified)) { |
|
136 | 136 | |
137 | 137 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304); |
138 | 138 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | case 405: //Not allowed |
172 | 172 | |
173 | - header('Allow: ' . $value, true, 405); |
|
173 | + header('Allow: '.$value, true, 405); |
|
174 | 174 | |
175 | 175 | break; |
176 | 176 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | case 501: //Not implemented |
185 | 185 | |
186 | - header('Allow: ' . $value, true, 501); |
|
186 | + header('Allow: '.$value, true, 501); |
|
187 | 187 | |
188 | 188 | break; |
189 | 189 |
@@ -41,13 +41,13 @@ |
||
41 | 41 | */ |
42 | 42 | private static function getHeaders() { |
43 | 43 | |
44 | - if ( function_exists('getallheaders') ) return getallheaders(); |
|
44 | + if (function_exists('getallheaders')) return getallheaders(); |
|
45 | 45 | |
46 | 46 | $headers = array(); |
47 | 47 | |
48 | - foreach ( $_SERVER as $name => $value ) { |
|
48 | + foreach ($_SERVER as $name => $value) { |
|
49 | 49 | |
50 | - if ( substr($name, 0, 5) == 'HTTP_' ) { |
|
50 | + if (substr($name, 0, 5) == 'HTTP_') { |
|
51 | 51 | |
52 | 52 | $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; |
53 | 53 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | private static function getParameters() { |
48 | 48 | |
49 | - switch( $_SERVER['REQUEST_METHOD'] ) { |
|
49 | + switch ($_SERVER['REQUEST_METHOD']) { |
|
50 | 50 | |
51 | 51 | case 'POST': |
52 | 52 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function set($content) { |
42 | 42 | |
43 | - if ( !is_scalar($content) ) { |
|
43 | + if (!is_scalar($content)) { |
|
44 | 44 | |
45 | 45 | throw new Exception("Invalid HTTP content"); |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function type($type = null) { |
56 | 56 | |
57 | - if ( is_null($type) ) { |
|
57 | + if (is_null($type)) { |
|
58 | 58 | |
59 | 59 | return $this->type; |
60 | 60 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function charset($charset = null) { |
70 | 70 | |
71 | - if ( is_null($charset) ) { |
|
71 | + if (is_null($charset)) { |
|
72 | 72 | |
73 | 73 | return $this->charset; |
74 | 74 |
@@ -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 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | private static function getParameters() { |
48 | 48 | |
49 | - switch( $_SERVER['REQUEST_METHOD'] ) { |
|
49 | + switch ($_SERVER['REQUEST_METHOD']) { |
|
50 | 50 | |
51 | 51 | case 'POST': |
52 | 52 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $ttl = $configuration->get('dispatcher-cache-ttl'); |
43 | 43 | |
44 | - if ( $ttl !== null && !defined('COMODOJO_CACHE_DEFAULT_TTL') ) { |
|
44 | + if ($ttl !== null && !defined('COMODOJO_CACHE_DEFAULT_TTL')) { |
|
45 | 45 | |
46 | 46 | define('COMODOJO_CACHE_DEFAULT_TTL', $ttl); |
47 | 47 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | |
50 | 50 | $folder = $configuration->get('dispatcher-cache-folder'); |
51 | 51 | |
52 | - $algorithm = self::getAlgorithm( $configuration->get('dispatcher-cache-algorithm') ); |
|
52 | + $algorithm = self::getAlgorithm($configuration->get('dispatcher-cache-algorithm')); |
|
53 | 53 | |
54 | - $manager = new CacheManager( $algorithm ); |
|
54 | + $manager = new CacheManager($algorithm); |
|
55 | 55 | |
56 | - if ( $enabled === true ) { |
|
56 | + if ($enabled === true) { |
|
57 | 57 | |
58 | - $manager->addProvider( new FileCache($folder) ); |
|
58 | + $manager->addProvider(new FileCache($folder)); |
|
59 | 59 | |
60 | 60 | } |
61 | 61 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected static function getAlgorithm($algorithm) { |
74 | 74 | |
75 | - switch ( strtoupper($algorithm) ) { |
|
75 | + switch (strtoupper($algorithm)) { |
|
76 | 76 | |
77 | 77 | case 'PICK_LAST': |
78 | 78 | $selected = CacheManager::PICK_LAST; |