@@ -10,7 +10,7 @@ |
||
10 | 10 | public function fetch(array $data): ResponseInterface |
11 | 11 | { |
12 | 12 | if ($this->getUrl() === 'http://www.JOI.com/schemas/ViaSub.WMS/FindOrders') { |
13 | - return new ResponseMock(file_get_contents(__DIR__ . '/../files/findOrders/response.xml')); |
|
13 | + return new ResponseMock(file_get_contents(__DIR__.'/../files/findOrders/response.xml')); |
|
14 | 14 | } |
15 | 15 | throw new \Exception; |
16 | 16 | } |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | |
18 | 18 | public function body(): string |
19 | 19 | { |
20 | - return (string) $this->response->getBody(); |
|
20 | + return (string)$this->response->getBody(); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function json(): array |
24 | 24 | { |
25 | 25 | $body = $this->body(); |
26 | - $xml = new DOMDocument( "1.0", "ISO-8859-15" ); |
|
26 | + $xml = new DOMDocument("1.0", "ISO-8859-15"); |
|
27 | 27 | $xml->loadXML($body); |
28 | 28 | |
29 | 29 | $body = null; |
30 | - foreach($xml->firstChild->childNodes as $node) { |
|
30 | + foreach ($xml->firstChild->childNodes as $node) { |
|
31 | 31 | if (!($node instanceof DOMText) && $node->tagName === 'soap:Body') { |
32 | 32 | $body = $node; |
33 | 33 | break; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | if ($body) { |
38 | 38 | $content = null; |
39 | - foreach($body->childNodes as $node) { |
|
39 | + foreach ($body->childNodes as $node) { |
|
40 | 40 | if (!($node instanceof DOMText)) { |
41 | 41 | $content = $node; |
42 | 42 | break; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $xml = new \SimpleXMLElement($xml); |
55 | 55 | $obj = json_decode(json_encode($xml)); |
56 | - foreach($obj as $param => $value) { |
|
56 | + foreach ($obj as $param => $value) { |
|
57 | 57 | return $value; |
58 | 58 | } |
59 | 59 | } |
@@ -23,7 +23,9 @@ |
||
23 | 23 | ]); |
24 | 24 | |
25 | 25 | $result = $response->json(); |
26 | - if (!is_array($result)) $result = [$result]; |
|
26 | + if (!is_array($result)) { |
|
27 | + $result = [$result]; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $finalOrders = []; |
29 | 31 | foreach ($result as $item) { |