| Total Complexity | 2 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class BitLyShortener extends RemoteShortener |
||
| 12 | { |
||
| 13 | protected $client; |
||
| 14 | protected $defaults; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Create a new Bit.ly shortener. |
||
| 18 | * |
||
| 19 | * @param \GuzzleHttp\ClientInterface $client |
||
| 20 | * @param string $token |
||
| 21 | * @param string $domain |
||
| 22 | * @return void |
||
| 23 | */ |
||
| 24 | 34 | public function __construct(ClientInterface $client, string $token, string $domain) |
|
| 25 | { |
||
| 26 | 34 | $this->client = $client; |
|
| 27 | 34 | $this->defaults = [ |
|
| 28 | 34 | 'allow_redirects' => false, |
|
| 29 | 34 | 'base_uri' => 'https://api-ssl.bitly.com', |
|
| 30 | 'headers' => [ |
||
| 31 | 34 | 'Accept' => 'application/json', |
|
| 32 | 34 | 'Authorization' => "Bearer $token", |
|
| 33 | 34 | 'Content-Type' => 'application/json', |
|
| 34 | ], |
||
| 35 | 'json' => [ |
||
| 36 | 34 | 'domain' => $domain, |
|
| 37 | ], |
||
| 38 | ]; |
||
| 39 | 34 | } |
|
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritDoc} |
||
| 43 | */ |
||
| 44 | 34 | public function shortenAsync($url, array $options = []) |
|
| 51 | 34 | }); |
|
| 52 | } |
||
| 54 |