@@ -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 |
@@ -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 . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost') . $uri . "/" ); |
|
55 | + return ($http.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost').$uri."/"); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | - public function set($content=null) { |
|
41 | + public function set($content = null) { |
|
42 | 42 | |
43 | - if ( !is_scalar($content) && $content != null ) { |
|
43 | + if (!is_scalar($content) && $content != null) { |
|
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 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function set($code) { |
50 | 50 | |
51 | - if ( !$this->codes->exists($code) ) { |
|
51 | + if (!$this->codes->exists($code)) { |
|
52 | 52 | |
53 | 53 | throw new Exception("Invalid HTTP Status Code $code"); |
54 | 54 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - public function description($code=null) { |
|
63 | + public function description($code = null) { |
|
64 | 64 | |
65 | - if ( is_null($code) ) return $this->codes->getMessage($this->status_code); |
|
65 | + if (is_null($code)) return $this->codes->getMessage($this->status_code); |
|
66 | 66 | |
67 | 67 | return $this->codes->getMessage($code); |
68 | 68 |
@@ -102,7 +102,7 @@ |
||
102 | 102 | |
103 | 103 | public function getMessage($code) { |
104 | 104 | |
105 | - if ( $this->exists($code) ) return $this->codes[$code]; |
|
105 | + if ($this->exists($code)) return $this->codes[$code]; |
|
106 | 106 | |
107 | 107 | throw new Exception("Invalid HTTP status code $code"); |
108 | 108 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | protected $dispatcher; |
31 | 31 | |
32 | - public function __construct( Dispatcher $dispatcher ) { |
|
32 | + public function __construct(Dispatcher $dispatcher) { |
|
33 | 33 | |
34 | 34 | parent::__construct('dispatcher'); |
35 | 35 |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!empty($this->path) && file_exists($this->path)) { |
110 | 110 | |
111 | - $local_name = "$this->path/" . ($as_slug ? $this->getSlug() : $this->getFileName()); |
|
111 | + $local_name = "$this->path/".($as_slug ? $this->getSlug() : $this->getFileName()); |
|
112 | 112 | |
113 | - if ( file_exists($local_name) ) { |
|
113 | + if (file_exists($local_name)) { |
|
114 | 114 | |
115 | 115 | $files = glob("$local_name*"); |
116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | - if ( move_uploaded_file($this->getTemporaryName(), $local_name) ) { |
|
123 | + if (move_uploaded_file($this->getTemporaryName(), $local_name)) { |
|
124 | 124 | |
125 | 125 | // return file_exists($local_name); |
126 | 126 | return true; |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | 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 | |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | public function getAsString($header = null) { |
40 | 40 | |
41 | - if ( is_null($header) ) { |
|
41 | + if (is_null($header)) { |
|
42 | 42 | |
43 | - return array_map( [$this, 'headerToString'], |
|
43 | + return array_map([$this, 'headerToString'], |
|
44 | 44 | array_keys($this->headers), |
45 | 45 | array_values($this->headers) |
46 | 46 | ); |
47 | 47 | |
48 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
48 | + } else if (array_key_exists($header, $this->headers)) { |
|
49 | 49 | |
50 | 50 | return self::headerToString($header, $this->headers[$header]); |
51 | 51 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | - public function set($header, $value=null) { |
|
56 | + public function set($header, $value = null) { |
|
57 | 57 | |
58 | - if ( is_null($value) ) { |
|
58 | + if (is_null($value)) { |
|
59 | 59 | |
60 | 60 | $header = explode(":", $header, 2); |
61 | 61 | |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | |
74 | 74 | public function delete($header = null) { |
75 | 75 | |
76 | - if ( is_null($header) ) { |
|
76 | + if (is_null($header)) { |
|
77 | 77 | |
78 | 78 | $this->headers = array(); |
79 | 79 | |
80 | 80 | return true; |
81 | 81 | |
82 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
82 | + } else if (array_key_exists($header, $this->headers)) { |
|
83 | 83 | |
84 | 84 | unset($this->headers[$header]); |
85 | 85 |