| @@ -23,10 +23,10 @@ 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; | 
| @@ -35,14 +35,14 @@ discard block | ||
| 35 | 35 | |
| 36 | 36 | public function webhookEnabled(Webhook $webhook) | 
| 37 | 37 |      { | 
| 38 | -        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); | |
| 38 | +        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); | |
| 39 | 39 | $response = json_decode((string) $response->getBody(), true); | 
| 40 | - return (isset($response['enabled'])?$response['enabled']:false); | |
| 40 | + return (isset($response['enabled']) ? $response['enabled'] : false); | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | public function webhookCreate(Webhook $webhook) | 
| 44 | 44 |      { | 
| 45 | -        $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ | |
| 45 | +        $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ | |
| 46 | 46 | 'json' => [ | 
| 47 | 47 | 'url' => $webhook->url(), | 
| 48 | 48 | 'enabled' => true | 
| @@ -52,19 +52,19 @@ discard block | ||
| 52 | 52 | |
| 53 | 53 | public function webhookDelete(Webhook $webhook) | 
| 54 | 54 |      { | 
| 55 | -        $this->connector->request('DELETE', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag); | |
| 55 | +        $this->connector->request('DELETE', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag); | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | public function webhookEnable(Webhook $webhook) | 
| 59 | 59 |      { | 
| 60 | 60 |          try { | 
| 61 | -            $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ | |
| 61 | +            $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ | |
| 62 | 62 | 'json' => [ | 
| 63 | 63 | 'enabled' => true | 
| 64 | 64 | ] | 
| 65 | 65 | ]); | 
| 66 | 66 |          } catch (ServerException $e) { | 
| 67 | -            if($e->getCode() !== 504 && $e->getCode() !== 502) { | |
| 67 | +            if ($e->getCode() !== 504 && $e->getCode() !== 502) { | |
| 68 | 68 | throw $e; | 
| 69 | 69 | } | 
| 70 | 70 | } | 
| @@ -72,7 +72,7 @@ discard block | ||
| 72 | 72 | |
| 73 | 73 | public function webhookDisable(Webhook $webhook) | 
| 74 | 74 |      { | 
| 75 | -        $this->connector->request('PUT', 'https://api.typeform.com/forms/'. $webhook->form_id .'/webhooks/' . $webhook->tag, [ | |
| 75 | +        $this->connector->request('PUT', 'https://api.typeform.com/forms/'.$webhook->form_id.'/webhooks/'.$webhook->tag, [ | |
| 76 | 76 | 'json' => [ | 
| 77 | 77 | 'enabled' => false | 
| 78 | 78 | ] | 
| @@ -81,13 +81,13 @@ discard block | ||
| 81 | 81 | |
| 82 | 82 | public function allResponses(string $formId) | 
| 83 | 83 |      { | 
| 84 | -        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.  $formId .'/responses', [ | |
| 84 | +        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId.'/responses', [ | |
| 85 | 85 | 'query' => [ | 
| 86 | 86 | 'page_size' => 1000 | 
| 87 | 87 | ] | 
| 88 | 88 | ]); | 
| 89 | 89 | $responses = json_decode((string) $response->getBody(), true); | 
| 90 | -        if($responses && array_key_exists('items', $responses)) { | |
| 90 | +        if ($responses && array_key_exists('items', $responses)) { | |
| 91 | 91 | return $responses['items']; | 
| 92 | 92 | } | 
| 93 | 93 | return []; | 
| @@ -95,9 +95,9 @@ discard block | ||
| 95 | 95 | |
| 96 | 96 | public function allFields(string $formId) | 
| 97 | 97 |      { | 
| 98 | -        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.  $formId); | |
| 98 | +        $response = $this->connector->request('GET', 'https://api.typeform.com/forms/'.$formId); | |
| 99 | 99 | $responses = json_decode((string) $response->getBody(), true); | 
| 100 | -        if($responses && array_key_exists('fields', $responses)) { | |
| 100 | +        if ($responses && array_key_exists('fields', $responses)) { | |
| 101 | 101 | return $responses['fields']; | 
| 102 | 102 | } | 
| 103 | 103 | return []; |