@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | public function webhookExists(Webhook $webhook) |
| 23 | 23 | { |
| 24 | 24 | try { |
| 25 | - $this->connector->request('GET', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
| 25 | + $this->connector->request('GET', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
| 26 | 26 | return true; |
| 27 | 27 | } catch (ClientException $e) { |
| 28 | - if($e->getCode() === 404){ |
|
| 28 | + if ($e->getCode() === 404) { |
|
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | throw $e; |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function webhookEnabled(Webhook $webhook) |
| 36 | 36 | { |
| 37 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
| 37 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
| 38 | 38 | $response = json_decode((string) $response->getBody(), true); |
| 39 | - return (isset($response['enabled'])?$response['enabled']:false); |
|
| 39 | + return (isset($response['enabled']) ? $response['enabled'] : false); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function webhookCreate(Webhook $webhook) |
| 43 | 43 | { |
| 44 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
| 44 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
| 45 | 45 | 'json' => [ |
| 46 | 46 | 'url' => $webhook->url(), |
| 47 | 47 | 'enabled' => true |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function webhookDelete(Webhook $webhook) |
| 53 | 53 | { |
| 54 | - $this->connector->request('DELETE', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
| 54 | + $this->connector->request('DELETE', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function webhookEnable(Webhook $webhook) |
| 58 | 58 | { |
| 59 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
| 59 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
| 60 | 60 | 'json' => [ |
| 61 | 61 | 'enabled' => true |
| 62 | 62 | ] |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function webhookDisable(Webhook $webhook) |
| 67 | 67 | { |
| 68 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
| 68 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
| 69 | 69 | 'json' => [ |
| 70 | 70 | 'enabled' => false |
| 71 | 71 | ] |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function allResponses(string $formId) |
| 76 | 76 | { |
| 77 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId .'/responses', [ |
|
| 77 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId.'/responses', [ |
|
| 78 | 78 | 'query' => [ |
| 79 | 79 | 'page_size' => 1000 |
| 80 | 80 | ] |
| 81 | 81 | ]); |
| 82 | 82 | $responses = json_decode((string) $response->getBody(), true); |
| 83 | - if($responses && array_key_exists('items', $responses)) { |
|
| 83 | + if ($responses && array_key_exists('items', $responses)) { |
|
| 84 | 84 | return $responses['items']; |
| 85 | 85 | } |
| 86 | 86 | return []; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function allFields(string $formId) |
| 91 | 91 | { |
| 92 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId); |
|
| 92 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId); |
|
| 93 | 93 | $responses = json_decode((string) $response->getBody(), true); |
| 94 | - if($responses && array_key_exists('fields', $responses)) { |
|
| 94 | + if ($responses && array_key_exists('fields', $responses)) { |
|
| 95 | 95 | return $responses['fields']; |
| 96 | 96 | } |
| 97 | 97 | return []; |