Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function syncAll() |
||
27 | { |
||
28 | $response = $this->altapayClient->getTerminals(); |
||
29 | |||
30 | foreach ($response->getTerminals() as $terminal) { |
||
31 | $entity = $this->terminalManager->findTerminalByTitle($terminal->getTitle()); |
||
32 | if (!$entity) { |
||
33 | $entity = $this->terminalManager->create(); |
||
34 | } |
||
35 | $entity |
||
36 | ->setTitle($terminal->getTitle()) |
||
37 | ->setCountry($terminal->getCountry()) |
||
38 | ->setNatures(array_map(function ($val) { |
||
39 | return (string) $val; |
||
40 | }, $terminal->getNatures())) |
||
41 | ->setCurrencies(array_map(function ($val) { |
||
42 | return (string) $val; |
||
43 | }, $terminal->getCurrencies())) |
||
44 | ; |
||
45 | |||
46 | $this->terminalManager->update($entity); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |