@@ -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,19 +51,19 @@ 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 | 59 | try { |
| 60 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
| 60 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
| 61 | 61 | 'json' => [ |
| 62 | 62 | 'enabled' => true |
| 63 | 63 | ] |
| 64 | 64 | ]); |
| 65 | 65 | } catch (ClientException $e) { |
| 66 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
| 66 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
| 67 | 67 | throw $e; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function webhookDisable(Webhook $webhook) |
| 73 | 73 | { |
| 74 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
| 74 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
| 75 | 75 | 'json' => [ |
| 76 | 76 | 'enabled' => false |
| 77 | 77 | ] |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function allResponses(string $formId) |
| 82 | 82 | { |
| 83 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId .'/responses', [ |
|
| 83 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId.'/responses', [ |
|
| 84 | 84 | 'query' => [ |
| 85 | 85 | 'page_size' => 1000 |
| 86 | 86 | ] |
| 87 | 87 | ]); |
| 88 | 88 | $responses = json_decode((string) $response->getBody(), true); |
| 89 | - if($responses && array_key_exists('items', $responses)) { |
|
| 89 | + if ($responses && array_key_exists('items', $responses)) { |
|
| 90 | 90 | return $responses['items']; |
| 91 | 91 | } |
| 92 | 92 | return []; |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function allFields(string $formId) |
| 96 | 96 | { |
| 97 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId); |
|
| 97 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId); |
|
| 98 | 98 | $responses = json_decode((string) $response->getBody(), true); |
| 99 | - if($responses && array_key_exists('fields', $responses)) { |
|
| 99 | + if ($responses && array_key_exists('fields', $responses)) { |
|
| 100 | 100 | return $responses['fields']; |
| 101 | 101 | } |
| 102 | 102 | return []; |