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 MaxMind\Db\Reader;
 4 
 5 /**
 6  * This class provides the metadata for the MaxMind DB file.
 7  *
 8  * @property integer nodeCount This is an unsigned 32-bit integer indicating
 9  * the number of nodes in the search tree.
10  *
11  * @property integer recordSize This is an unsigned 16-bit integer. It
12  * indicates the number of bits in a record in the search tree. Note that each
13  * node consists of two records.
14  *
15  * @property integer ipVersion This is an unsigned 16-bit integer which is
16  * always 4 or 6. It indicates whether the database contains IPv4 or IPv6
17  * address data.
18  *
19  * @property string databaseType This is a string that indicates the structure
20  * of each data record associated with an IP address. The actual definition of
21  * these structures is left up to the database creator.
22  *
23  * @property array languages An array of strings, each of which is a language
24  * code. A given record may contain data items that have been localized to
25  * some or all of these languages. This may be undefined.
26  *
27  * @property integer binaryFormatMajorVersion This is an unsigned 16-bit
28  * integer indicating the major version number for the database's binary
29  * format.
30  *
31  * @property integer binaryFormatMinorVersion This is an unsigned 16-bit
32  * integer indicating the minor version number for the database's binary format.
33  *
34  * @property integer buildEpoch This is an unsigned 64-bit integer that
35  * contains the database build timestamp as a Unix epoch value.
36  *
37  * @property array description This key will always point to a map
38  * (associative array). The keys of that map will be language codes, and the
39  * values will be a description in that language as a UTF-8 string. May be
40  * undefined for some databases.
41  */
42 class Metadata
43 {
44     private $binaryFormatMajorVersion;
45     private $binaryFormatMinorVersion;
46     private $buildEpoch;
47     private $databaseType;
48     private $description;
49     private $ipVersion;
50     private $languages;
51     private $nodeByteSize;
52     private $nodeCount;
53     private $recordSize;
54     private $searchTreeSize;
55 
56     public function __construct($metadata)
57     {
58         $this->binaryFormatMajorVersion =
59             $metadata['binary_format_major_version'];
60         $this->binaryFormatMinorVersion =
61             $metadata['binary_format_minor_version'];
62         $this->buildEpoch = $metadata['build_epoch'];
63         $this->databaseType = $metadata['database_type'];
64         $this->languages = $metadata['languages'];
65         $this->description = $metadata['description'];
66         $this->ipVersion = $metadata['ip_version'];
67         $this->nodeCount = $metadata['node_count'];
68         $this->recordSize = $metadata['record_size'];
69         $this->nodeByteSize = $this->recordSize / 4;
70         $this->searchTreeSize = $this->nodeCount * $this->nodeByteSize;
71     }
72 
73     public function __get($var)
74     {
75         return $this->$var;
76     }
77 }
78 
GeoIP2 PHP API v2.4.4 API documentation generated by ApiGen