GeoIP2 PHP API v2.4.4
  • Namespace
  • Class

Namespaces

  • GeoIp2
    • Database
    • Exception
    • Model
    • Record
    • WebService
  • MaxMind
    • Db
      • Reader
  • PHP

Classes

  • GeoIp2\Database\Reader
  • GeoIp2\Model\AnonymousIp
  • GeoIp2\Model\City
  • GeoIp2\Model\ConnectionType
  • GeoIp2\Model\Country
  • GeoIp2\Model\Domain
  • GeoIp2\Model\Enterprise
  • GeoIp2\Model\Insights
  • GeoIp2\Model\Isp
  • GeoIp2\Record\AbstractPlaceRecord
  • GeoIp2\Record\AbstractRecord
  • GeoIp2\Record\City
  • GeoIp2\Record\Continent
  • GeoIp2\Record\Country
  • GeoIp2\Record\Location
  • GeoIp2\Record\MaxMind
  • GeoIp2\Record\Postal
  • GeoIp2\Record\RepresentedCountry
  • GeoIp2\Record\Subdivision
  • GeoIp2\Record\Traits
  • GeoIp2\WebService\Client
  • MaxMind\Db\Reader
  • MaxMind\Db\Reader\Decoder
  • MaxMind\Db\Reader\Metadata
  • MaxMind\Db\Reader\Util

Interfaces

  • GeoIp2\ProviderInterface

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • GeoIp2\Exception\AddressNotFoundException
  • GeoIp2\Exception\AuthenticationException
  • GeoIp2\Exception\GeoIp2Exception
  • GeoIp2\Exception\HttpException
  • GeoIp2\Exception\InvalidRequestException
  • GeoIp2\Exception\OutOfQueriesException
  • InvalidArgumentException
  • LogicException
  • MaxMind\Db\Reader\InvalidDatabaseException
 1 <?php
 2 
 3 namespace GeoIp2\Record;
 4 
 5 abstract class AbstractPlaceRecord extends AbstractRecord
 6 {
 7     private $locales;
 8 
 9     /**
10      * @ignore
11      */
12     public function __construct($record, $locales = array('en'))
13     {
14         $this->locales = $locales;
15         parent::__construct($record);
16     }
17 
18     /**
19      * @ignore
20      */
21     public function __get($attr)
22     {
23         if ($attr == 'name') {
24             return $this->name();
25         } else {
26             return parent::__get($attr);
27         }
28     }
29 
30     /**
31      * @ignore
32      */
33     public function __isset($attr)
34     {
35         if ($attr == 'name') {
36             return $this->firstSetNameLocale() == null ? false : true;
37         } else {
38             return parent::__isset($attr);
39         }
40     }
41 
42     private function name()
43     {
44         $locale = $this->firstSetNameLocale();
45         return $locale === null ? null : $this->names[$locale];
46     }
47 
48     private function firstSetNameLocale()
49     {
50         foreach ($this->locales as $locale) {
51             if (isset($this->names[$locale])) {
52                 return $locale;
53             }
54         }
55         return null;
56     }
57 }
58 
GeoIP2 PHP API v2.4.4 API documentation generated by ApiGen