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