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