Total Complexity | 3 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | class IsGdShortener extends RemoteShortener |
||
11 | { |
||
12 | protected $client; |
||
13 | protected $defaults; |
||
14 | |||
15 | /** |
||
16 | * Create a new Is.gd shortener. |
||
17 | * |
||
18 | * @param \GuzzleHttp\ClientInterface $client |
||
19 | * @param bool $linkPreviews |
||
20 | * @param bool $statistics |
||
21 | * @return void |
||
22 | */ |
||
23 | 120 | public function __construct(ClientInterface $client, bool $linkPreviews, bool $statistics) |
|
24 | { |
||
25 | 120 | $this->client = $client; |
|
26 | 120 | $this->defaults = [ |
|
27 | 120 | 'allow_redirects' => false, |
|
28 | 120 | 'base_uri' => $linkPreviews ? 'https://v.gd' : 'https://is.gd', |
|
29 | 'query' => [ |
||
30 | 120 | 'format' => 'simple', |
|
31 | 120 | 'logstats' => intval($statistics), |
|
32 | ], |
||
33 | ]; |
||
34 | 120 | } |
|
35 | |||
36 | /** |
||
37 | * {@inheritDoc} |
||
38 | */ |
||
39 | 96 | public function shortenAsync($url, array $options = []) |
|
46 | 96 | }); |
|
47 | } |
||
49 |