@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | private $code = 307; |
31 | 31 | |
32 | - private $supported_redirect_codes = array(201,301,302,303,307); |
|
32 | + private $supported_redirect_codes = array(201, 301, 302, 303, 307); |
|
33 | 33 | |
34 | 34 | private $location = null; |
35 | 35 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return ObjectRequest $this |
137 | 137 | */ |
138 | - public function setHeader($header, $value=null) { |
|
138 | + public function setHeader($header, $value = null) { |
|
139 | 139 | |
140 | 140 | $this->headers[$header] = $value; |
141 | 141 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function unsetHeader($header) { |
154 | 154 | |
155 | - if ( isset($this->headers[$header]) ) { |
|
155 | + if (isset($this->headers[$header])) { |
|
156 | 156 | |
157 | 157 | unset($this->headers[$header]); |
158 | 158 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function getHeader($header) { |
175 | 175 | |
176 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
176 | + if (isset($this->headers[$header])) return $this->headers[$header]; |
|
177 | 177 | |
178 | 178 | return null; |
179 | 179 |
@@ -173,7 +173,9 @@ |
||
173 | 173 | */ |
174 | 174 | public function getHeader($header) { |
175 | 175 | |
176 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
176 | + if ( isset($this->headers[$header]) ) { |
|
177 | + return $this->headers[$header]; |
|
178 | + } |
|
177 | 179 | |
178 | 180 | return null; |
179 | 181 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | private $charset = DISPATCHER_DEFAULT_ENCODING; |
39 | 39 | |
40 | - private $supported_success_codes = array(200,202,204); |
|
40 | + private $supported_success_codes = array(200, 202, 204); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Set service name |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return ObjectRequest $this |
139 | 139 | */ |
140 | - public function setHeader($header, $value=null) { |
|
140 | + public function setHeader($header, $value = null) { |
|
141 | 141 | |
142 | 142 | $this->headers[$header] = $value; |
143 | 143 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function unsetHeader($header) { |
156 | 156 | |
157 | - if ( isset($this->headers[$header]) ) { |
|
157 | + if (isset($this->headers[$header])) { |
|
158 | 158 | |
159 | 159 | unset($this->headers[$header]); |
160 | 160 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getHeader($header) { |
177 | 177 | |
178 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
178 | + if (isset($this->headers[$header])) return $this->headers[$header]; |
|
179 | 179 | |
180 | 180 | return null; |
181 | 181 |
@@ -175,7 +175,9 @@ |
||
175 | 175 | */ |
176 | 176 | public function getHeader($header) { |
177 | 177 | |
178 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
178 | + if ( isset($this->headers[$header]) ) { |
|
179 | + return $this->headers[$header]; |
|
180 | + } |
|
179 | 181 | |
180 | 182 | return null; |
181 | 183 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | private $code = 500; |
31 | 31 | |
32 | - private $supported_error_codes = array(400,403,404,405,500,501,503); |
|
32 | + private $supported_error_codes = array(400, 403, 404, 405, 500, 501, 503); |
|
33 | 33 | |
34 | 34 | private $content = null; |
35 | 35 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return ObjectRequest $this |
139 | 139 | */ |
140 | - public function setHeader($header, $value=null) { |
|
140 | + public function setHeader($header, $value = null) { |
|
141 | 141 | |
142 | 142 | $this->headers[$header] = $value; |
143 | 143 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function unsetHeader($header) { |
156 | 156 | |
157 | - if ( isset($this->headers[$header]) ) { |
|
157 | + if (isset($this->headers[$header])) { |
|
158 | 158 | |
159 | 159 | unset($this->headers[$header]); |
160 | 160 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getHeader($header) { |
177 | 177 | |
178 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
178 | + if (isset($this->headers[$header])) return $this->headers[$header]; |
|
179 | 179 | |
180 | 180 | return null; |
181 | 181 |
@@ -175,7 +175,9 @@ |
||
175 | 175 | */ |
176 | 176 | public function getHeader($header) { |
177 | 177 | |
178 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
178 | + if ( isset($this->headers[$header]) ) { |
|
179 | + return $this->headers[$header]; |
|
180 | + } |
|
179 | 181 | |
180 | 182 | return null; |
181 | 183 |
@@ -38,15 +38,15 @@ |
||
38 | 38 | |
39 | 39 | $name = defined('DISPATCHER_LOG_NAME') ? DISPATCHER_LOG_NAME : 'dispatcher-default'; |
40 | 40 | |
41 | - $level = $this->getLevel( defined('DISPATCHER_LOG_LEVEL') ? DISPATCHER_LOG_LEVEL : 'DEBUG' ); |
|
41 | + $level = $this->getLevel(defined('DISPATCHER_LOG_LEVEL') ? DISPATCHER_LOG_LEVEL : 'DEBUG'); |
|
42 | 42 | |
43 | 43 | $target = defined('DISPATCHER_LOG_TARGET') ? DISPATCHER_LOG_TARGET : null; |
44 | 44 | |
45 | 45 | $this->logger = new Logger($name); |
46 | 46 | |
47 | - if ( $enabled ) { |
|
47 | + if ($enabled) { |
|
48 | 48 | |
49 | - $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler( defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level); |
|
49 | + $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler(defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | else { |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler( defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level); |
50 | 50 | |
51 | - } |
|
52 | - else { |
|
51 | + } else { |
|
53 | 52 | |
54 | 53 | $handler = new NullHandler($level); |
55 | 54 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - final public function fromJson($data, $raw=false) { |
|
41 | + final public function fromJson($data, $raw = false) { |
|
42 | 42 | |
43 | - if ( !is_string($data) ) throw new Exception("Invalid data for JSON deserialization"); |
|
43 | + if (!is_string($data)) throw new Exception("Invalid data for JSON deserialization"); |
|
44 | 44 | |
45 | 45 | return json_decode($data, !$raw); |
46 | 46 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | final public function fromXml($data) { |
57 | 57 | |
58 | - if ( !is_string($data) ) throw new Exception("Invalid data for XML deserialization"); |
|
58 | + if (!is_string($data)) throw new Exception("Invalid data for XML deserialization"); |
|
59 | 59 | |
60 | 60 | $xmlEngine = new XML(); |
61 | 61 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | final public function fromYaml($data) { |
74 | 74 | |
75 | - if ( !is_string($data) ) throw new Exception("Invalid data for YAML deserialization"); |
|
75 | + if (!is_string($data)) throw new Exception("Invalid data for YAML deserialization"); |
|
76 | 76 | |
77 | 77 | return \Spyc::YAMLLoadString($data); |
78 | 78 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | final public function fromExport($data) { |
89 | 89 | |
90 | - if ( !is_string($data) ) throw new Exception("Invalid data for EXPORT deserialization"); |
|
90 | + if (!is_string($data)) throw new Exception("Invalid data for EXPORT deserialization"); |
|
91 | 91 | |
92 | 92 | return unserialize($data); |
93 | 93 |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | final public function fromJson($data, $raw=false) { |
42 | 42 | |
43 | - if ( !is_string($data) ) throw new Exception("Invalid data for JSON deserialization"); |
|
43 | + if ( !is_string($data) ) { |
|
44 | + throw new Exception("Invalid data for JSON deserialization"); |
|
45 | + } |
|
44 | 46 | |
45 | 47 | return json_decode($data, !$raw); |
46 | 48 | |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | */ |
56 | 58 | final public function fromXml($data) { |
57 | 59 | |
58 | - if ( !is_string($data) ) throw new Exception("Invalid data for XML deserialization"); |
|
60 | + if ( !is_string($data) ) { |
|
61 | + throw new Exception("Invalid data for XML deserialization"); |
|
62 | + } |
|
59 | 63 | |
60 | 64 | $xmlEngine = new XML(); |
61 | 65 | |
@@ -72,7 +76,9 @@ discard block |
||
72 | 76 | */ |
73 | 77 | final public function fromYaml($data) { |
74 | 78 | |
75 | - if ( !is_string($data) ) throw new Exception("Invalid data for YAML deserialization"); |
|
79 | + if ( !is_string($data) ) { |
|
80 | + throw new Exception("Invalid data for YAML deserialization"); |
|
81 | + } |
|
76 | 82 | |
77 | 83 | return \Spyc::YAMLLoadString($data); |
78 | 84 | |
@@ -87,7 +93,9 @@ discard block |
||
87 | 93 | */ |
88 | 94 | final public function fromExport($data) { |
89 | 95 | |
90 | - if ( !is_string($data) ) throw new Exception("Invalid data for EXPORT deserialization"); |
|
96 | + if ( !is_string($data) ) { |
|
97 | + throw new Exception("Invalid data for EXPORT deserialization"); |
|
98 | + } |
|
91 | 99 | |
92 | 100 | return unserialize($data); |
93 | 101 |