Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
13 / 13 |
Adserving | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
13 / 13 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
url | |
100.00% |
1 / 1 |
2 | |
100.00% |
8 / 8 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\ApiExternal\Services\Adserving; |
4 | |
5 | class Adserving |
6 | { |
7 | protected $data; |
8 | protected $coordinates; |
9 | protected $url; |
10 | |
11 | public function __construct(Data $data, RedisCoordinates $coordinates, WSUrl $url, $ip) |
12 | { |
13 | $this->data = $data; |
14 | $this->coordinates = $coordinates; |
15 | $this->url = $url; |
16 | |
17 | $this->data->ip = $ip; |
18 | } |
19 | |
20 | public function url($data, $type) |
21 | { |
22 | $this->data->visualId = (int) $data['v']; |
23 | $this->data->index = (int) $data['i']; |
24 | $this->data->input = $data['input'] ?? 'ip'; |
25 | $this->data->zip_code = $data['zip_code'] ?? null; |
26 | $this->data->type = $type; |
27 | |
28 | // Remove in further |
29 | if ($this->data->input === 'zip_code') { $this->coordinates->fromZipCode(); } |
30 | |
31 | $this->coordinates->setToData(); |
32 | |
33 | return $this->url->get(); |
34 | } |
35 | } |