Spaces:
No application file
No application file
File size: 1,343 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<?php
namespace Mautic\CoreBundle\IpLookup;
class TelizeLookup extends AbstractRemoteDataLookup
{
public string $offset = '';
public string $area_code = '';
public string $dma_code = '';
public string $country_code3 = '';
public string $continent_code = '';
public string $country_code = '';
public string $region_code = '';
public function getAttribution(): string
{
return '<a href="https://market.mashape.com/fcambus/telize/" target="_blank">Telize</a> is a paid lookup service.';
}
protected function getUrl(): string
{
return "https://telize-v1.p.mashape.com/geoip/{$this->ip}";
}
protected function getHeaders(): array
{
return [
'X-Mashape-Key' => $this->auth,
'Accept' => 'application/json',
];
}
/**
* Populates properties with obtained data from the service.
*
* @param mixed $response Response from the service
*/
protected function parseResponse($response)
{
$data = json_decode($response);
if ($data) {
foreach ($data as $key => $value) {
if ('postal_code' == $key) {
$key = 'zipcode';
}
$this->$key = $value;
}
}
}
}
|