@@ -49,7 +49,7 @@  | 
                                                    ||
| 49 | 49 | break;  | 
                                                        
| 50 | 50 | case 'sqlite3':  | 
                                                        
| 51 | 51 | $db = new \SQLite3($this->config['sqlite3_db']);  | 
                                                        
| 52 | - $cache = new \Doctrine\Common\Cache\SQLite3Cache($db, $this->config['sqlite3_table']);  | 
                                                        |
| 52 | + $cache = new \Doctrine\Common\Cache\SQLite3Cache($db, $this->config['sqlite3_table']);  | 
                                                        |
| 53 | 53 | break;  | 
                                                        
| 54 | 54 | default:  | 
                                                        
| 55 | 55 |                            throw new CacheException('Invalid cache system'); | 
                                                        
@@ -28,36 +28,36 @@  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 |  class Auth { | 
                                                        
| 30 | 30 | |
| 31 | - private $url;  | 
                                                        |
| 32 | - private $api;  | 
                                                        |
| 31 | + private $url;  | 
                                                        |
| 32 | + private $api;  | 
                                                        |
| 33 | 33 | |
| 34 | - public function __construct(ApiInterface $api, array $config)  | 
                                                        |
| 35 | -      { | 
                                                        |
| 36 | - $this->api = $api;  | 
                                                        |
| 37 | - $this->url = 'https://api-ssl.bitly.com/oauth/access_token';  | 
                                                        |
| 38 | - $key = base64_encode($config['clientid_username'].":".$config['clientsecret_password']);  | 
                                                        |
| 39 | - $api->setApiKey($key);  | 
                                                        |
| 40 | - }  | 
                                                        |
| 34 | + public function __construct(ApiInterface $api, array $config)  | 
                                                        |
| 35 | +       { | 
                                                        |
| 36 | + $this->api = $api;  | 
                                                        |
| 37 | + $this->url = 'https://api-ssl.bitly.com/oauth/access_token';  | 
                                                        |
| 38 | + $key = base64_encode($config['clientid_username'].":".$config['clientsecret_password']);  | 
                                                        |
| 39 | + $api->setApiKey($key);  | 
                                                        |
| 40 | + }  | 
                                                        |
| 41 | 41 | |
| 42 | - /*  | 
                                                        |
| 42 | + /*  | 
                                                        |
| 43 | 43 | Exchanging a Username and Password for an Access Token  | 
                                                        
| 44 | 44 | https://dev.bitly.com/docs/getting-started/authentication  | 
                                                        
| 45 | 45 | */  | 
                                                        
| 46 | - public function exchangeToken(array $params)  | 
                                                        |
| 47 | -      { | 
                                                        |
| 48 | - $params['grant_type'] = 'password';  | 
                                                        |
| 49 | - $result = $this->api->post($this->url, $params);  | 
                                                        |
| 50 | - return json_decode($result->getResponse(), true)['access_token'];  | 
                                                        |
| 51 | - }  | 
                                                        |
| 46 | + public function exchangeToken(array $params)  | 
                                                        |
| 47 | +       { | 
                                                        |
| 48 | + $params['grant_type'] = 'password';  | 
                                                        |
| 49 | + $result = $this->api->post($this->url, $params);  | 
                                                        |
| 50 | + return json_decode($result->getResponse(), true)['access_token'];  | 
                                                        |
| 51 | + }  | 
                                                        |
| 52 | 52 | |
| 53 | - /*  | 
                                                        |
| 53 | + /*  | 
                                                        |
| 54 | 54 | HTTP Basic Authentication Flow  | 
                                                        
| 55 | 55 | https://dev.bitly.com/docs/getting-started/authentication  | 
                                                        
| 56 | 56 | */  | 
                                                        
| 57 | - public function basicAuthFlow(array $params)  | 
                                                        |
| 58 | -      { | 
                                                        |
| 59 | - $result = $this->api->post($this->url, $params);  | 
                                                        |
| 60 | - return $result->getResponse();  | 
                                                        |
| 61 | - }  | 
                                                        |
| 57 | + public function basicAuthFlow(array $params)  | 
                                                        |
| 58 | +       { | 
                                                        |
| 59 | + $result = $this->api->post($this->url, $params);  | 
                                                        |
| 60 | + return $result->getResponse();  | 
                                                        |
| 61 | + }  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | }  | 
                                                        
@@ -28,22 +28,22 @@  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 |  class Bsd { | 
                                                        
| 30 | 30 | |
| 31 | - private $url;  | 
                                                        |
| 32 | - private $api;  | 
                                                        |
| 31 | + private $url;  | 
                                                        |
| 32 | + private $api;  | 
                                                        |
| 33 | 33 | |
| 34 | - public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | -      { | 
                                                        |
| 36 | - $this->api = $api;  | 
                                                        |
| 37 | - $this->url = 'https://api-ssl.bitly.com/v4/bsds';  | 
                                                        |
| 38 | - }  | 
                                                        |
| 34 | + public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | +       { | 
                                                        |
| 36 | + $this->api = $api;  | 
                                                        |
| 37 | + $this->url = 'https://api-ssl.bitly.com/v4/bsds';  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /*  | 
                                                        |
| 40 | + /*  | 
                                                        |
| 41 | 41 | Get BSDs  | 
                                                        
| 42 | 42 | https://dev.bitly.com/api-reference#getBSDs  | 
                                                        
| 43 | 43 | */  | 
                                                        
| 44 | - public function getBSDs()  | 
                                                        |
| 45 | -      { | 
                                                        |
| 46 | - return $this->api->get($this->url);  | 
                                                        |
| 47 | - }  | 
                                                        |
| 44 | + public function getBSDs()  | 
                                                        |
| 45 | +       { | 
                                                        |
| 46 | + return $this->api->get($this->url);  | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | 48 | |
| 49 | 49 | }  | 
                                                        
@@ -28,85 +28,85 @@  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 |  class Campaign { | 
                                                        
| 30 | 30 | |
| 31 | - private $url;  | 
                                                        |
| 32 | - private $api;  | 
                                                        |
| 31 | + private $url;  | 
                                                        |
| 32 | + private $api;  | 
                                                        |
| 33 | 33 | |
| 34 | - public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | -      { | 
                                                        |
| 36 | - $this->api = $api;  | 
                                                        |
| 37 | - $this->url = 'https://api-ssl.bitly.com/v4';  | 
                                                        |
| 38 | - }  | 
                                                        |
| 34 | + public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | +       { | 
                                                        |
| 36 | + $this->api = $api;  | 
                                                        |
| 37 | + $this->url = 'https://api-ssl.bitly.com/v4';  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /*  | 
                                                        |
| 40 | + /*  | 
                                                        |
| 41 | 41 | Create Channel  | 
                                                        
| 42 | 42 | https://dev.bitly.com/api-reference#createChannel  | 
                                                        
| 43 | 43 | */  | 
                                                        
| 44 | - public function createChannel(array $params)  | 
                                                        |
| 45 | -      { | 
                                                        |
| 46 | - return $this->api->post($this->url.'/channels', $params);  | 
                                                        |
| 47 | - }  | 
                                                        |
| 44 | + public function createChannel(array $params)  | 
                                                        |
| 45 | +       { | 
                                                        |
| 46 | + return $this->api->post($this->url.'/channels', $params);  | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | 48 | |
| 49 | - /*  | 
                                                        |
| 49 | + /*  | 
                                                        |
| 50 | 50 | Retrieve Channels  | 
                                                        
| 51 | 51 | https://dev.bitly.com/api-reference#getChannels  | 
                                                        
| 52 | 52 | */  | 
                                                        
| 53 | - public function getChannels(array $params)  | 
                                                        |
| 54 | -      { | 
                                                        |
| 55 | - return $this->api->get($this->url.'/channels', $params);  | 
                                                        |
| 56 | - }  | 
                                                        |
| 53 | + public function getChannels(array $params)  | 
                                                        |
| 54 | +       { | 
                                                        |
| 55 | + return $this->api->get($this->url.'/channels', $params);  | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | 57 | |
| 58 | - /*  | 
                                                        |
| 58 | + /*  | 
                                                        |
| 59 | 59 | Create Campaign  | 
                                                        
| 60 | 60 | https://dev.bitly.com/api-reference#createCampaign  | 
                                                        
| 61 | 61 | */  | 
                                                        
| 62 | - public function createCampaign(array $params)  | 
                                                        |
| 63 | -      { | 
                                                        |
| 64 | - return $this->api->post($this->url.'/campaigns', $params);  | 
                                                        |
| 65 | - }  | 
                                                        |
| 62 | + public function createCampaign(array $params)  | 
                                                        |
| 63 | +       { | 
                                                        |
| 64 | + return $this->api->post($this->url.'/campaigns', $params);  | 
                                                        |
| 65 | + }  | 
                                                        |
| 66 | 66 | |
| 67 | - /*  | 
                                                        |
| 67 | + /*  | 
                                                        |
| 68 | 68 | Retrieve Campaigns  | 
                                                        
| 69 | 69 | https://dev.bitly.com/api-reference#getCampaigns  | 
                                                        
| 70 | 70 | */  | 
                                                        
| 71 | - public function getCampaigns(array $params)  | 
                                                        |
| 72 | -      { | 
                                                        |
| 73 | - return $this->api->get($this->url.'/campaigns', $params);  | 
                                                        |
| 74 | - }  | 
                                                        |
| 71 | + public function getCampaigns(array $params)  | 
                                                        |
| 72 | +       { | 
                                                        |
| 73 | + return $this->api->get($this->url.'/campaigns', $params);  | 
                                                        |
| 74 | + }  | 
                                                        |
| 75 | 75 | |
| 76 | - /*  | 
                                                        |
| 76 | + /*  | 
                                                        |
| 77 | 77 | Retrieve a Campaign  | 
                                                        
| 78 | 78 | https://dev.bitly.com/api-reference#getCampaign  | 
                                                        
| 79 | 79 | */  | 
                                                        
| 80 | - public function getCampaign(string $campaign_guid)  | 
                                                        |
| 81 | -      { | 
                                                        |
| 82 | - return $this->api->get($this->url.'/campaigns/'.$campaign_guid);  | 
                                                        |
| 83 | - }  | 
                                                        |
| 80 | + public function getCampaign(string $campaign_guid)  | 
                                                        |
| 81 | +       { | 
                                                        |
| 82 | + return $this->api->get($this->url.'/campaigns/'.$campaign_guid);  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | 84 | |
| 85 | - /*  | 
                                                        |
| 85 | + /*  | 
                                                        |
| 86 | 86 | Update Campaign  | 
                                                        
| 87 | 87 | https://dev.bitly.com/api-reference#updateCampaign  | 
                                                        
| 88 | 88 | */  | 
                                                        
| 89 | - public function updateCampaign(string $campaign_guid, array $params)  | 
                                                        |
| 90 | -      { | 
                                                        |
| 91 | - return $this->api->patch($this->url.'/campaigns/'.$campaign_guid, $params);  | 
                                                        |
| 92 | - }  | 
                                                        |
| 89 | + public function updateCampaign(string $campaign_guid, array $params)  | 
                                                        |
| 90 | +       { | 
                                                        |
| 91 | + return $this->api->patch($this->url.'/campaigns/'.$campaign_guid, $params);  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | 93 | |
| 94 | - /*  | 
                                                        |
| 94 | + /*  | 
                                                        |
| 95 | 95 | Get A Channel  | 
                                                        
| 96 | 96 | https://dev.bitly.com/api-reference#getChannel  | 
                                                        
| 97 | 97 | */  | 
                                                        
| 98 | - public function getChannel(string $channel_guid)  | 
                                                        |
| 99 | -      { | 
                                                        |
| 100 | - return $this->api->get($this->url.'/channels/'.$channel_guid);  | 
                                                        |
| 101 | - }  | 
                                                        |
| 98 | + public function getChannel(string $channel_guid)  | 
                                                        |
| 99 | +       { | 
                                                        |
| 100 | + return $this->api->get($this->url.'/channels/'.$channel_guid);  | 
                                                        |
| 101 | + }  | 
                                                        |
| 102 | 102 | |
| 103 | - /*  | 
                                                        |
| 103 | + /*  | 
                                                        |
| 104 | 104 | Update A Channel  | 
                                                        
| 105 | 105 | https://dev.bitly.com/api-reference#updateChannel  | 
                                                        
| 106 | 106 | */  | 
                                                        
| 107 | - public function updateChannel(string $channel_guid, array $params)  | 
                                                        |
| 108 | -      { | 
                                                        |
| 109 | - return $this->api->patch($this->url.'/channels/'.$channel_guid, $params);  | 
                                                        |
| 110 | - }  | 
                                                        |
| 107 | + public function updateChannel(string $channel_guid, array $params)  | 
                                                        |
| 108 | +       { | 
                                                        |
| 109 | + return $this->api->patch($this->url.'/channels/'.$channel_guid, $params);  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | 111 | |
| 112 | 112 | }  | 
                                                        
@@ -45,18 +45,18 @@ discard block  | 
                                                    ||
| 45 | 45 |                {  | 
                                                        
| 46 | 46 |                       if (!function_exists('curl_init'))  | 
                                                        
| 47 | 47 |                       {  | 
                                                        
| 48 | -                         throw new CurlException("cURL is not available. This API wrapper cannot be used.");  | 
                                                        |
| 48 | +                            throw new CurlException("cURL is not available. This API wrapper cannot be used.");  | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | 51 | if (isset($api_key))  | 
                                                        
| 52 | 52 |                       { | 
                                                        
| 53 | - $this->setApiKey($api_key);  | 
                                                        |
| 53 | + $this->setApiKey($api_key);  | 
                                                        |
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | if ($basic === true)  | 
                                                        
| 57 | 57 |                       { | 
                                                        
| 58 | - $this->_api_key_var = 'Authorization: Basic ';  | 
                                                        |
| 59 | - $this->json = false;  | 
                                                        |
| 58 | + $this->_api_key_var = 'Authorization: Basic ';  | 
                                                        |
| 59 | + $this->json = false;  | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | |
@@ -117,31 +117,31 @@ discard block  | 
                                                    ||
| 117 | 117 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_HEADER, true);  | 
                                                        
| 118 | 118 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLINFO_HEADER_OUT, true);  | 
                                                        
| 119 | 119 |                       if ($this->curlProxy) {   | 
                                                        
| 120 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PROXY, $this->curlProxy);  | 
                                                        |
| 120 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PROXY, $this->curlProxy);  | 
                                                        |
| 121 | 121 | }  | 
                                                        
| 122 | 122 |                       if ($this->_curl_callback) {  | 
                                                        
| 123 | - call_user_func($this->_curl_callback, $ch, $params, $headers, $method);  | 
                                                        |
| 123 | + call_user_func($this->_curl_callback, $ch, $params, $headers, $method);  | 
                                                        |
| 124 | 124 | }  | 
                                                        
| 125 | 125 |                       switch (strtoupper($method)) {  | 
                                                        
| 126 | 126 | case 'PATCH':  | 
                                                        
| 127 | 127 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PATCH, true);  | 
                                                        
| 128 | 128 | |
| 129 | 129 |                                            if (!empty($params)) { | 
                                                        
| 130 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 130 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 131 | 131 | }  | 
                                                        
| 132 | 132 | break;  | 
                                                        
| 133 | 133 | case 'PUT':  | 
                                                        
| 134 | 134 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PUT, true);  | 
                                                        
| 135 | 135 | |
| 136 | 136 |                                            if (!empty($params)) { | 
                                                        
| 137 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 137 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 138 | 138 | }  | 
                                                        
| 139 | 139 | break;  | 
                                                        
| 140 | 140 | case 'DELETE':  | 
                                                        
| 141 | 141 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_DELETE, true);  | 
                                                        
| 142 | 142 | |
| 143 | 143 |                                            if (!empty($params)) { | 
                                                        
| 144 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 144 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, json_encode($params));  | 
                                                        |
| 145 | 145 | }  | 
                                                        
| 146 | 146 | break;  | 
                                                        
| 147 | 147 | case 'POST':  | 
                                                        
@@ -163,10 +163,10 @@ discard block  | 
                                                    ||
| 163 | 163 | $this->response = curl_exec(/** @scrutinizer ignore-type */ $ch);  | 
                                                        
| 164 | 164 | |
| 165 | 165 |                       if (curl_errno(/** @scrutinizer ignore-type */ $ch)) { | 
                                                        
| 166 | - $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 167 | - $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 168 | - curl_close(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 169 | - return;  | 
                                                        |
| 166 | + $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 167 | + $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 168 | + curl_close(/** @scrutinizer ignore-type */ $ch);  | 
                                                        |
| 169 | + return;  | 
                                                        |
| 170 | 170 | }  | 
                                                        
| 171 | 171 | |
| 172 | 172 | $this->curlInfo = curl_getinfo(/** @scrutinizer ignore-type */ $ch);  | 
                                                        
@@ -176,14 +176,14 @@ discard block  | 
                                                    ||
| 176 | 176 | |
| 177 | 177 | private function _createHeaders($headers = null)  | 
                                                        
| 178 | 178 |                { | 
                                                        
| 179 | - $headers[] = $this->_api_key_var.$this->_api_key;  | 
                                                        |
| 180 | -                      if ($this->json === true) { | 
                                                        |
| 181 | - $headers[] = 'Content-Type: application/json';  | 
                                                        |
| 182 | - }  | 
                                                        |
| 183 | -                      if ($this->accept === true) { | 
                                                        |
| 184 | - $headers[] = 'Accept: application/json';  | 
                                                        |
| 185 | - }  | 
                                                        |
| 186 | - return $headers;  | 
                                                        |
| 179 | + $headers[] = $this->_api_key_var.$this->_api_key;  | 
                                                        |
| 180 | +                            if ($this->json === true) { | 
                                                        |
| 181 | + $headers[] = 'Content-Type: application/json';  | 
                                                        |
| 182 | + }  | 
                                                        |
| 183 | +                            if ($this->accept === true) { | 
                                                        |
| 184 | + $headers[] = 'Accept: application/json';  | 
                                                        |
| 185 | + }  | 
                                                        |
| 186 | + return $headers;  | 
                                                        |
| 187 | 187 | }  | 
                                                        
| 188 | 188 | |
| 189 | 189 | private function _parseHeaders($raw_headers)  | 
                                                        
@@ -218,12 +218,12 @@ discard block  | 
                                                    ||
| 218 | 218 | |
| 219 | 219 | private function _getHeaders()  | 
                                                        
| 220 | 220 |                { | 
                                                        
| 221 | - return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size']));  | 
                                                        |
| 221 | + return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size']));  | 
                                                        |
| 222 | 222 | }  | 
                                                        
| 223 | 223 | |
| 224 | 224 | private function _getBody()  | 
                                                        
| 225 | 225 |                { | 
                                                        
| 226 | - return substr($this->response, $this->curlInfo['header_size']);  | 
                                                        |
| 226 | + return substr($this->response, $this->curlInfo['header_size']);  | 
                                                        |
| 227 | 227 | }  | 
                                                        
| 228 | 228 | |
| 229 | 229 | public function getResponse()  | 
                                                        
@@ -239,7 +239,7 @@ discard block  | 
                                                    ||
| 239 | 239 | public function get($url, $params = null, $headers = null)  | 
                                                        
| 240 | 240 |                { | 
                                                        
| 241 | 241 |                       if (!empty($params)) { | 
                                                        
| 242 | - $url .= '?'.http_build_query($params);  | 
                                                        |
| 242 | + $url .= '?'.http_build_query($params);  | 
                                                        |
| 243 | 243 | }  | 
                                                        
| 244 | 244 | return $this->_call($url, $params, $headers, $method = "GET");  | 
                                                        
| 245 | 245 | }  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | public function post($url, $params = null, $headers = null)  | 
                                                        
| 248 | 248 |                { | 
                                                        
| 249 | 249 |                       if ($this->json === true) { | 
                                                        
| 250 | - $params = json_encode($params);  | 
                                                        |
| 250 | + $params = json_encode($params);  | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | return $this->_call($url, $params, $headers, $method = "POST");  | 
                                                        
| 253 | 253 | }  | 
                                                        
@@ -160,7 +160,7 @@  | 
                                                    ||
| 160 | 160 | */  | 
                                                        
| 161 | 161 | public function getGroupClicks(string $group_guid, array $params = array())  | 
                                                        
| 162 | 162 |         { | 
                                                        
| 163 | - return $this->api->get($this->url.'/'.$group_guid."/clicks", $params);  | 
                                                        |
| 163 | + return $this->api->get($this->url.'/'.$group_guid."/clicks", $params);  | 
                                                        |
| 164 | 164 | |
| 165 | 165 | }  | 
                                                        
| 166 | 166 | }  | 
                                                        
@@ -28,67 +28,67 @@  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 |  class Webhook { | 
                                                        
| 30 | 30 | |
| 31 | - private $url;  | 
                                                        |
| 32 | - private $api;  | 
                                                        |
| 31 | + private $url;  | 
                                                        |
| 32 | + private $api;  | 
                                                        |
| 33 | 33 | |
| 34 | - public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | -      { | 
                                                        |
| 36 | - $this->api = $api;  | 
                                                        |
| 37 | - $this->url = 'https://api-ssl.bitly.com/v4/webhooks';  | 
                                                        |
| 38 | - }  | 
                                                        |
| 34 | + public function __construct(ApiInterface $api)  | 
                                                        |
| 35 | +       { | 
                                                        |
| 36 | + $this->api = $api;  | 
                                                        |
| 37 | + $this->url = 'https://api-ssl.bitly.com/v4/webhooks';  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /*  | 
                                                        |
| 40 | + /*  | 
                                                        |
| 41 | 41 | Create Webhook  | 
                                                        
| 42 | 42 | https://dev.bitly.com/api-reference#createWebhook  | 
                                                        
| 43 | 43 | */  | 
                                                        
| 44 | - public function createWebhook(array $params)  | 
                                                        |
| 45 | -      { | 
                                                        |
| 46 | - return $this->api->post($this->url, $params);  | 
                                                        |
| 47 | - }  | 
                                                        |
| 44 | + public function createWebhook(array $params)  | 
                                                        |
| 45 | +       { | 
                                                        |
| 46 | + return $this->api->post($this->url, $params);  | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | 48 | |
| 49 | - /*  | 
                                                        |
| 49 | + /*  | 
                                                        |
| 50 | 50 | Get Webhooks  | 
                                                        
| 51 | 51 | https://dev.bitly.com/api-reference#getWebhooks  | 
                                                        
| 52 | 52 | */  | 
                                                        
| 53 | - public function getWebhooks(string $organization_guid)  | 
                                                        |
| 54 | -      { | 
                                                        |
| 55 | -             return $this->api->get("https://api-ssl.bitly.com/v4/organizations/".$organization_guid."/webhooks"); | 
                                                        |
| 56 | - }  | 
                                                        |
| 53 | + public function getWebhooks(string $organization_guid)  | 
                                                        |
| 54 | +       { | 
                                                        |
| 55 | +              return $this->api->get("https://api-ssl.bitly.com/v4/organizations/".$organization_guid."/webhooks"); | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | 57 | |
| 58 | - /*  | 
                                                        |
| 58 | + /*  | 
                                                        |
| 59 | 59 | Retrieve Webhook  | 
                                                        
| 60 | 60 | https://dev.bitly.com/api-reference#getWebhook  | 
                                                        
| 61 | 61 | */  | 
                                                        
| 62 | - public function getWebhook(string $webhook_guid)  | 
                                                        |
| 63 | -      { | 
                                                        |
| 64 | - return $this->api->get($this->url."/".$webhook_guid);  | 
                                                        |
| 65 | - }  | 
                                                        |
| 62 | + public function getWebhook(string $webhook_guid)  | 
                                                        |
| 63 | +       { | 
                                                        |
| 64 | + return $this->api->get($this->url."/".$webhook_guid);  | 
                                                        |
| 65 | + }  | 
                                                        |
| 66 | 66 | |
| 67 | - /*  | 
                                                        |
| 67 | + /*  | 
                                                        |
| 68 | 68 | Update Webhook  | 
                                                        
| 69 | 69 | https://dev.bitly.com/api-reference#updateWebhook  | 
                                                        
| 70 | 70 | */  | 
                                                        
| 71 | - public function updateWebhook(string $webhook_guid, array $params)  | 
                                                        |
| 72 | -      { | 
                                                        |
| 73 | - return $this->api->patch($this->url."/".$webhook_guid, $params);  | 
                                                        |
| 74 | - }  | 
                                                        |
| 71 | + public function updateWebhook(string $webhook_guid, array $params)  | 
                                                        |
| 72 | +       { | 
                                                        |
| 73 | + return $this->api->patch($this->url."/".$webhook_guid, $params);  | 
                                                        |
| 74 | + }  | 
                                                        |
| 75 | 75 | |
| 76 | - /*  | 
                                                        |
| 76 | + /*  | 
                                                        |
| 77 | 77 | Delete Webhook  | 
                                                        
| 78 | 78 | https://dev.bitly.com/api-reference#deleteWebhook  | 
                                                        
| 79 | 79 | */  | 
                                                        
| 80 | - public function deleteWebhook(string $webhook_guid)  | 
                                                        |
| 81 | -      { | 
                                                        |
| 82 | - return $this->api->delete($this->url."/".$webhook_guid);  | 
                                                        |
| 83 | - }  | 
                                                        |
| 80 | + public function deleteWebhook(string $webhook_guid)  | 
                                                        |
| 81 | +       { | 
                                                        |
| 82 | + return $this->api->delete($this->url."/".$webhook_guid);  | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | 84 | |
| 85 | 85 | /*  | 
                                                        
| 86 | 86 | Verify Webhook  | 
                                                        
| 87 | 87 | https://dev.bitly.com/api-reference#verifyWebhook  | 
                                                        
| 88 | 88 | */  | 
                                                        
| 89 | - public function verifyWebhook(string $webhook_guid)  | 
                                                        |
| 90 | -      { | 
                                                        |
| 91 | - return $this->api->post($this->url."/".$webhook_guid."/verify");  | 
                                                        |
| 92 | - }  | 
                                                        |
| 89 | + public function verifyWebhook(string $webhook_guid)  | 
                                                        |
| 90 | +       { | 
                                                        |
| 91 | + return $this->api->post($this->url."/".$webhook_guid."/verify");  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | 93 | |
| 94 | 94 | }  | 
                                                        
@@ -178,10 +178,10 @@ discard block  | 
                                                    ||
| 178 | 178 | */  | 
                                                        
| 179 | 179 | public function deleteBitlink(string $bitlink)  | 
                                                        
| 180 | 180 |         { | 
                                                        
| 181 | - return $this->api->delete($this->url.'/bitlinks/'.$bitlink);  | 
                                                        |
| 181 | + return $this->api->delete($this->url.'/bitlinks/'.$bitlink);  | 
                                                        |
| 182 | 182 | }  | 
                                                        
| 183 | 183 | |
| 184 | - /*  | 
                                                        |
| 184 | + /*  | 
                                                        |
| 185 | 185 | Create a QR Code  | 
                                                        
| 186 | 186 | https://dev.bitly.com/api-reference/#createBitlinkQRCode  | 
                                                        
| 187 | 187 | */  | 
                                                        
@@ -190,7 +190,7 @@ discard block  | 
                                                    ||
| 190 | 190 | return $this->api->post($this->url.'/bitlinks/'.$bitlink.'/qr', $params);  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | 192 | |
| 193 | - /*  | 
                                                        |
| 193 | + /*  | 
                                                        |
| 194 | 194 | Update a QR Code  | 
                                                        
| 195 | 195 | https://dev.bitly.com/api-reference/#updateBitlinkQRCode  | 
                                                        
| 196 | 196 | */  | 
                                                        
@@ -169,7 +169,7 @@  | 
                                                    ||
| 169 | 169 | */  | 
                                                        
| 170 | 170 | public function updateBitlinksByGroup(string $group_guid, array $params = array())  | 
                                                        
| 171 | 171 |         { | 
                                                        
| 172 | - return $this->api->patch($this->url . '/groups/'.$group_guid.'/bitlinks', $params);  | 
                                                        |
| 172 | + return $this->api->patch($this->url.'/groups/'.$group_guid.'/bitlinks', $params);  | 
                                                        |
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
| 175 | 175 | /*  |