for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace yiicod\geo;
use yiicod\geo\base\GeoDataInterface;
/**
* Class GeoData
* Class to make geo-data structure
*
* @package yiicod\geo
* @author Dmitry Turchanin
*/
class GeoData implements GeoDataInterface
{
* Data to keep.
* @var array
private $data = [];
* GeoDataInterface constructor.
* @param array $data
public function __construct(array $data = [])
$this->setData($data);
}
* Gets country code.
* @return null|string
public function getCountryCode(): ?string
$result = $this->data['countryCode'] ?? null;
return $result;
* Gets country name
public function getCountryName(): ?string
$result = $this->data['countryName'] ?? null;
* Gets region
public function getRegion(): ?string
$result = $this->data['region'] ?? null;
* Gets region name
public function getRegionName(): ?string
$result = $this->data['regionName'] ?? null;
* Gets region code
public function getRegionCode(): ?string
$result = $this->data['regionCode'] ?? null;
* Gets city
public function getCity(): ?string
$result = $this->data['city'] ?? null;
* Gets latitude
public function getLatitude(): ?string
$result = $this->data['latitude'] ?? null;
* Gets longitude
public function getLongitude(): ?string
$result = $this->data['longitude'] ?? null;
* Gets IP
public function getIp(): string
$result = $this->data['ip'] ?? null;
* Gets all data
* @return array
public function getData(): array
return $this->data;
* Sets all data
public function setData(array $data): void
$this->data = $data;