| Total Complexity | 5 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Coverage | 15.79% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class IPStack |
||
| 14 | { |
||
| 15 | protected $curl; |
||
| 16 | protected $baseUrl; |
||
| 17 | private $apiKey; |
||
| 18 | private $url; |
||
| 19 | |||
| 20 | |||
| 21 | /** |
||
| 22 | * Create complete url to curl |
||
| 23 | * |
||
| 24 | * @var string $ip IP address to look up |
||
| 25 | * @var string $baseUrl API base URL |
||
| 26 | * @var string $apiKey API key for ipstack usage |
||
| 27 | * @var string $url Complete url to curl |
||
| 28 | * |
||
| 29 | * @return void. |
||
|
|
|||
| 30 | */ |
||
| 31 | 11 | public function setUrl($ip) |
|
| 32 | { |
||
| 33 | 11 | $this->url = $this->baseUrl . $ip . "?access_key=" . $this->apiKey; |
|
| 34 | 11 | } |
|
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | /** |
||
| 39 | * Set API key |
||
| 40 | * |
||
| 41 | * @var string $apiKey API key for weather service |
||
| 42 | * |
||
| 43 | * @return void. |
||
| 44 | */ |
||
| 45 | public function setApiKey($apiKey) |
||
| 46 | { |
||
| 47 | $this->apiKey = $apiKey; |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | /** |
||
| 52 | * Set Base URL |
||
| 53 | * |
||
| 54 | * @var string $baseUrl URL for weather service |
||
| 55 | * |
||
| 56 | * @return void. |
||
| 57 | */ |
||
| 58 | public function setBaseUrl(String $baseUrl) |
||
| 61 | } |
||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | /** |
||
| 66 | * Set curl model |
||
| 67 | * |
||
| 68 | * @var string $curl Curl model |
||
| 69 | * |
||
| 70 | * @return void. |
||
| 71 | */ |
||
| 72 | public function setCurl(Object $curl) |
||
| 75 | } |
||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | /** |
||
| 81 | * Get data from ipstack |
||
| 82 | * |
||
| 83 | * @var string $url Complete url to curl |
||
| 84 | * |
||
| 85 | * @return array $res Result from ipstack API. |
||
| 86 | */ |
||
| 87 | public function getData() |
||
| 99 | } |
||
| 100 | } |
||
| 101 |