@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | public function webhookExists(Webhook $webhook) |
24 | 24 | { |
25 | 25 | try { |
26 | - $this->connector->request('GET', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
26 | + $this->connector->request('GET', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
27 | 27 | return true; |
28 | 28 | } catch (ClientException $e) { |
29 | - if($e->getCode() === 404){ |
|
29 | + if ($e->getCode() === 404) { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | throw $e; |
33 | 33 | } catch (ServerException $e) { |
34 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
34 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
35 | 35 | throw $e; |
36 | 36 | } |
37 | 37 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | public function webhookEnabled(Webhook $webhook) |
41 | 41 | { |
42 | 42 | try { |
43 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
43 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
44 | 44 | $response = json_decode((string) $response->getBody(), true); |
45 | - return (isset($response['enabled'])?$response['enabled']:false); |
|
45 | + return (isset($response['enabled']) ? $response['enabled'] : false); |
|
46 | 46 | } catch (ServerException $e) { |
47 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
47 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
48 | 48 | throw $e; |
49 | 49 | } |
50 | 50 | } |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | public function webhookCreate(Webhook $webhook) |
55 | 55 | { |
56 | 56 | try { |
57 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
57 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
58 | 58 | 'json' => [ |
59 | 59 | 'url' => $webhook->url(), |
60 | 60 | 'enabled' => true |
61 | 61 | ] |
62 | 62 | ]); |
63 | 63 | } catch (ServerException $e) { |
64 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
64 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
65 | 65 | throw $e; |
66 | 66 | } |
67 | 67 | } |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | public function webhookDelete(Webhook $webhook) |
71 | 71 | { |
72 | 72 | try { |
73 | - $this->connector->request('DELETE', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); |
|
73 | + $this->connector->request('DELETE', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); |
|
74 | 74 | } catch (ServerException $e) { |
75 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
75 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
76 | 76 | throw $e; |
77 | 77 | } |
78 | 78 | } |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | public function webhookEnable(Webhook $webhook) |
82 | 82 | { |
83 | 83 | try { |
84 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
84 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
85 | 85 | 'json' => [ |
86 | 86 | 'enabled' => true |
87 | 87 | ] |
88 | 88 | ]); |
89 | 89 | } catch (ServerException $e) { |
90 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
90 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
91 | 91 | throw $e; |
92 | 92 | } |
93 | 93 | } |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | public function webhookDisable(Webhook $webhook) |
97 | 97 | { |
98 | 98 | try { |
99 | - $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ |
|
99 | + $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ |
|
100 | 100 | 'json' => [ |
101 | 101 | 'enabled' => false |
102 | 102 | ] |
103 | 103 | ]); |
104 | 104 | } catch (ServerException $e) { |
105 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
105 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
106 | 106 | throw $e; |
107 | 107 | } |
108 | 108 | } |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | public function allResponses(string $formId) |
112 | 112 | { |
113 | 113 | try { |
114 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId .'/responses', [ |
|
114 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId.'/responses', [ |
|
115 | 115 | 'query' => [ |
116 | 116 | 'page_size' => 1000 |
117 | 117 | ] |
118 | 118 | ]); |
119 | 119 | } catch (ServerException $e) { |
120 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
120 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
121 | 121 | throw $e; |
122 | 122 | } |
123 | 123 | } |
124 | 124 | $responses = json_decode((string) $response->getBody(), true); |
125 | - if($responses && array_key_exists('items', $responses)) { |
|
125 | + if ($responses && array_key_exists('items', $responses)) { |
|
126 | 126 | return $responses['items']; |
127 | 127 | } |
128 | 128 | return []; |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | public function allFields(string $formId) |
132 | 132 | { |
133 | 133 | try { |
134 | - $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $formId); |
|
134 | + $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId); |
|
135 | 135 | } catch (ServerException $e) { |
136 | - if($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
136 | + if ($e->getCode() !== 504 && $e->getCode() !== 502) { |
|
137 | 137 | throw $e; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | $responses = json_decode((string) $response->getBody(), true); |
141 | - if($responses && array_key_exists('fields', $responses)) { |
|
141 | + if ($responses && array_key_exists('fields', $responses)) { |
|
142 | 142 | return $responses['fields']; |
143 | 143 | } |
144 | 144 | return []; |