1: <?php
2:
3: namespace GeoIp2\Model;
4:
5: /**
6: * Model class for the data returned by GeoIP2 Country web service and database.
7: *
8: * The only difference between the City and Insights model classes is which
9: * fields in each record may be populated. See
10: * http://dev.maxmind.com/geoip/geoip2/web-services more details.
11: *
12: * @property-read \GeoIp2\Record\Continent $continent Continent data for the
13: * requested IP address.
14: * @property-read \GeoIp2\Record\Country $country Country data for the requested
15: * IP address. This object represents the country where MaxMind believes the
16: * end user is located.
17: * @property-read \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
18: * account.
19: * @property-read \GeoIp2\Record\Country $registeredCountry Registered country
20: * data for the requested IP address. This record represents the country
21: * where the ISP has registered a given IP block and may differ from the
22: * user's country.
23: * @property-read \GeoIp2\Record\RepresentedCountry $representedCountry
24: * Represented country data for the requested IP address. The represented
25: * country is used for things like military bases. It is only present when
26: * the represented country differs from the country.
27: * @property-read \GeoIp2\Record\Traits $traits Data for the traits of the
28: * requested IP address.
29: */
30: class Country extends AbstractModel
31: {
32: protected $continent;
33: protected $country;
34: protected $locales;
35: protected $maxmind;
36: protected $registeredCountry;
37: protected $representedCountry;
38: protected $traits;
39:
40: /**
41: * @ignore
42: *
43: * @param mixed $raw
44: * @param mixed $locales
45: */
46: public function __construct($raw, $locales = ['en'])
47: {
48: parent::__construct($raw);
49:
50: $this->continent = new \GeoIp2\Record\Continent(
51: $this->get('continent'),
52: $locales
53: );
54: $this->country = new \GeoIp2\Record\Country(
55: $this->get('country'),
56: $locales
57: );
58: $this->maxmind = new \GeoIp2\Record\MaxMind($this->get('maxmind'));
59: $this->registeredCountry = new \GeoIp2\Record\Country(
60: $this->get('registered_country'),
61: $locales
62: );
63: $this->representedCountry = new \GeoIp2\Record\RepresentedCountry(
64: $this->get('represented_country'),
65: $locales
66: );
67: $this->traits = new \GeoIp2\Record\Traits($this->get('traits'));
68:
69: $this->locales = $locales;
70: }
71: }
72: