PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.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 / lib / packages / MaxMind / Db / Reader / Metadata.php

Metadata.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/MaxMind/Db/Reader/Metadata.php

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