Overview

Namespaces

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

Classes

  • GeoIp2\Database\Reader
  • GeoIp2\Model\AnonymousIp
  • GeoIp2\Model\Asn
  • 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
  • JsonSerializable
  • Throwable

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
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace GeoIp2\Record;
 4: 
 5: abstract class AbstractPlaceRecord extends AbstractRecord
 6: {
 7:     private $locales;
 8: 
 9:     /**
10:      * @ignore
11:      *
12:      * @param mixed $record
13:      * @param mixed $locales
14:      */
15:     public function __construct($record, $locales = ['en'])
16:     {
17:         $this->locales = $locales;
18:         parent::__construct($record);
19:     }
20: 
21:     /**
22:      * @ignore
23:      *
24:      * @param mixed $attr
25:      */
26:     public function __get($attr)
27:     {
28:         if ($attr === 'name') {
29:             return $this->name();
30:         }
31: 
32:         return parent::__get($attr);
33:     }
34: 
35:     /**
36:      * @ignore
37:      *
38:      * @param mixed $attr
39:      */
40:     public function __isset($attr)
41:     {
42:         if ($attr === 'name') {
43:             return $this->firstSetNameLocale() === null ? false : true;
44:         }
45: 
46:         return parent::__isset($attr);
47:     }
48: 
49:     private function name()
50:     {
51:         $locale = $this->firstSetNameLocale();
52: 
53:         return $locale === null ? null : $this->names[$locale];
54:     }
55: 
56:     private function firstSetNameLocale()
57:     {
58:         foreach ($this->locales as $locale) {
59:             if (isset($this->names[$locale])) {
60:                 return $locale;
61:             }
62:         }
63: 
64:         return null;
65:     }
66: }
67: 
GeoIP2 PHP API v2.9.0 API documentation generated by ApiGen