Conditions | 3 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3.0884 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 4 | public function downloadXml(DownloadXmlCommand $command): DownloadXmlResult |
|
26 | { |
||
27 | 4 | $soapCaller = $this->settings()->createCallerForService(Services::utilities()); |
|
28 | do { |
||
29 | 4 | $rawResponse = $soapCaller->call('get_xml', [ |
|
30 | 4 | 'uuid' => $command->uuid(), |
|
31 | 4 | 'taxpayer_id' => $command->rfc(), |
|
32 | 4 | 'invoice_type' => $command->type(), |
|
33 | 4 | ]); |
|
34 | 4 | $result = new DownloadXmlResult($rawResponse); |
|
35 | // Finkok sometimes returns the path to the file instead of content (Ticket #18950) |
||
36 | 4 | if ('.xml' === substr($result->xml(), -4)) { |
|
37 | usleep(200000); // 0.2 seconds |
||
38 | continue; |
||
39 | } |
||
40 | 4 | break; |
|
41 | } while (true); |
||
42 | 4 | return $result; |
|
43 | } |
||
45 |