| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 12 | class CustomerVatIdsDeprecationUpdater |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Connection |
||
| 16 | */ |
||
| 17 | private $connection; |
||
| 18 | |||
| 19 | public function __construct(Connection $connection) |
||
| 20 | { |
||
| 21 | $this->connection = $connection; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function updateByEvent(EntityWrittenEvent $event): void |
||
| 25 | { |
||
| 26 | foreach ($event->getPayloads() as $payload) { |
||
| 27 | if (isset($payload['vatIds'])) { |
||
| 28 | $this->updateVatIdsInCustomer($payload['vatIds'], $payload['id']); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | private function updateVatIdsInCustomer(array $vatIds, string $customerId): void |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 53 |