PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.4.0
Defender Security – Malware Scanner, Login Security & Firewall v5.4.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / extra / maxmind-db / reader / src / MaxMind / Db / Reader / Metadata.php

Metadata.php in Defender Security – Malware Scanner, Login Security & Firewall 5.4.0, at src/extra/maxmind-db/reader/src/MaxMind/Db/Reader/Metadata.php

119 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare( strict_types=1 );
4
5 namespace MaxMind\Db\Reader;
6
7 /**
8 * This class provides the metadata for the MaxMind DB file.
9 */
10 class Metadata {
11 /**
12 * This is an unsigned 16-bit integer indicating the major version number
13 * for the database's binary format.
14 *
15 * @var int
16 */
17 public $binaryFormatMajorVersion;
18
19 /**
20 * This is an unsigned 16-bit integer indicating the minor version number
21 * for the database's binary format.
22 *
23 * @var int
24 */
25 public $binaryFormatMinorVersion;
26
27 /**
28 * This is an unsigned 64-bit integer that contains the database build
29 * timestamp as a Unix epoch value.
30 *
31 * @var int
32 */
33 public $buildEpoch;
34
35 /**
36 * This is a string that indicates the structure of each data record
37 * associated with an IP address. The actual definition of these
38 * structures is left up to the database creator.
39 *
40 * @var string
41 */
42 public $databaseType;
43
44 /**
45 * This key will always point to a map (associative array). The keys of
46 * that map will be language codes, and the values will be a description
47 * in that language as a UTF-8 string. May be undefined for some
48 * databases.
49 *
50 * @var array
51 */
52 public $description;
53
54 /**
55 * This is an unsigned 16-bit integer which is always 4 or 6. It indicates
56 * whether the database contains IPv4 or IPv6 address data.
57 *
58 * @var int
59 */
60 public $ipVersion;
61
62 /**
63 * An array of strings, each of which is a language code. A given record
64 * may contain data items that have been localized to some or all of
65 * these languages. This may be undefined.
66 *
67 * @var array
68 */
69 public $languages;
70
71 /**
72 * @var int
73 */
74 public $nodeByteSize;
75
76 /**
77 * This is an unsigned 32-bit integer indicating the number of nodes in
78 * the search tree.
79 *
80 * @var int
81 */
82 public $nodeCount;
83
84 /**
85 * This is an unsigned 16-bit integer. It indicates the number of bits in a
86 * record in the search tree. Note that each node consists of two records.
87 *
88 * @var int
89 */
90 public $recordSize;
91
92 /**
93 * @var int
94 */
95 public $searchTreeSize;
96
97 public function __construct( array $metadata ) {
98 if ( \func_num_args() !== 1 ) {
99 throw new \ArgumentCountError(
100 sprintf( '%s() expects exactly 1 parameter, %d given', __METHOD__, \func_num_args() )
101 );
102 }
103
104 $this->binaryFormatMajorVersion =
105 $metadata['binary_format_major_version'];
106 $this->binaryFormatMinorVersion =
107 $metadata['binary_format_minor_version'];
108 $this->buildEpoch = $metadata['build_epoch'];
109 $this->databaseType = $metadata['database_type'];
110 $this->languages = $metadata['languages'];
111 $this->description = $metadata['description'];
112 $this->ipVersion = $metadata['ip_version'];
113 $this->nodeCount = $metadata['node_count'];
114 $this->recordSize = $metadata['record_size'];
115 $this->nodeByteSize = $this->recordSize / 4;
116 $this->searchTreeSize = $this->nodeCount * $this->nodeByteSize;
117 }
118 }
119