@@ -27,14 +27,14 @@ |
||
| 27 | 27 | return $array; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public static function converToObject(array $data) |
|
| 31 | - { |
|
| 32 | - $object = new \stdClass(); |
|
| 30 | + public static function converToObject(array $data) |
|
| 31 | + { |
|
| 32 | + $object = new \stdClass(); |
|
| 33 | 33 | |
| 34 | - foreach ($data as $key => $value) { |
|
| 35 | - $object->$key = $value; |
|
| 36 | - } |
|
| 34 | + foreach ($data as $key => $value) { |
|
| 35 | + $object->$key = $value; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - return $object; |
|
| 38 | + return $object; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $json = JsonFactory::create(); |
| 25 | 25 | $post = PostFactory::create(); |
| 26 | - $formData = FormDataFactory::create(); |
|
| 26 | + $formData = FormDataFactory::create(); |
|
| 27 | 27 | $urlEncode = FormUrlEncodedFactory::create(); |
| 28 | 28 | $textPlain = TextPlainFactory::create(); |
| 29 | 29 | $xml = XmlFactory::create(); |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | |
| 7 | 7 | class TextPlain implements Handler, Advancer |
| 8 | 8 | { |
| 9 | - private $handler; |
|
| 9 | + private $handler; |
|
| 10 | 10 | |
| 11 | - public function getBody($content) |
|
| 12 | - { |
|
| 13 | - return $content; |
|
| 14 | - } |
|
| 11 | + public function getBody($content) |
|
| 12 | + { |
|
| 13 | + return $content; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function next(Handler $handler) |
|
| 17 | - { |
|
| 18 | - $this->handler = $handler; |
|
| 19 | - } |
|
| 16 | + public function next(Handler $handler) |
|
| 17 | + { |
|
| 18 | + $this->handler = $handler; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function handle($server) |
|
| 22 | - { |
|
| 23 | - if (ContentHelper::contentIs($server, 'text/plain')) { |
|
| 24 | - return $this->getBody($server->getContent()); |
|
| 25 | - } |
|
| 21 | + public function handle($server) |
|
| 22 | + { |
|
| 23 | + if (ContentHelper::contentIs($server, 'text/plain')) { |
|
| 24 | + return $this->getBody($server->getContent()); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $this->handler->handle($server); |
|
| 28 | - } |
|
| 27 | + return $this->handler->handle($server); |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -6,34 +6,34 @@ |
||
| 6 | 6 | |
| 7 | 7 | class XML implements Handler, Advancer |
| 8 | 8 | { |
| 9 | - private $handler; |
|
| 10 | - |
|
| 11 | - public function getBody($content) |
|
| 12 | - { |
|
| 13 | - return simplexml_load_string($content); |
|
| 14 | - } |
|
| 15 | - |
|
| 16 | - public function next(Handler $handler) |
|
| 17 | - { |
|
| 18 | - $this->handler = $handler; |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - private function isTextXml($server) |
|
| 22 | - { |
|
| 23 | - return ContentHelper::contentIs($server, 'text/xml'); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - private function isApplicationXml($server) |
|
| 27 | - { |
|
| 28 | - return ContentHelper::contentIs($server, 'application/xml'); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public function handle($server) |
|
| 32 | - { |
|
| 33 | - if ($this->isTextXml($server) || $this->isApplicationXml($server)) { |
|
| 34 | - return $this->getBody($server->getContent()); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - return $this->handler->handle($server); |
|
| 38 | - } |
|
| 9 | + private $handler; |
|
| 10 | + |
|
| 11 | + public function getBody($content) |
|
| 12 | + { |
|
| 13 | + return simplexml_load_string($content); |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + public function next(Handler $handler) |
|
| 17 | + { |
|
| 18 | + $this->handler = $handler; |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + private function isTextXml($server) |
|
| 22 | + { |
|
| 23 | + return ContentHelper::contentIs($server, 'text/xml'); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + private function isApplicationXml($server) |
|
| 27 | + { |
|
| 28 | + return ContentHelper::contentIs($server, 'application/xml'); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + public function handle($server) |
|
| 32 | + { |
|
| 33 | + if ($this->isTextXml($server) || $this->isApplicationXml($server)) { |
|
| 34 | + return $this->getBody($server->getContent()); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + return $this->handler->handle($server); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function getBody($content) |
| 12 | 12 | { |
| 13 | - return $content; |
|
| 13 | + return $content; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function next(Handler $handler) |