Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
34 | public function createWebhooks(string $storeName, array $topics) |
||
35 | { |
||
36 | $api = $this->apis->getForStore($storeName); |
||
37 | |||
38 | foreach ($topics as $topic) { |
||
39 | $webhook = GenericResource::create([ |
||
40 | 'topic' => $topic, |
||
41 | 'address' => $this->eventBridgeArn, |
||
42 | 'format' => 'json', |
||
43 | ]); |
||
44 | |||
45 | try { |
||
46 | $api->Webhook->create($webhook); |
||
47 | } catch (ClientException $e) { |
||
48 | if ($e->getResponse()->getStatusCode() == 422) { |
||
49 | continue; |
||
50 | } |
||
51 | |||
52 | throw $e; |
||
53 | } |
||
79 |