$MAGIC_NUMBER
$MAGIC_NUMBER :
Data file component
This class is responsible for loading the data file and walking the IPV4 Radix Trie to find the properties for a given User-Agent.
getProperties( $key) : mixed
Selects a value for a given IPv4 address, traversing tree and choosing most specific value available for a given address.
$key |
value at most specific IPv4 network in a tree for a given IPv4 address
getPropertyNames() : array
Return a list of all the property names.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275array of property names
getPropertyNamesAsStrings() : string
Return a list of all the property names.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275of property names
getCopyright() : string
Get data file copyright.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275the copyright
getCreationDate() : string
Get data file creation date.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275the creationDate
getVersion() : string
Get data file version.
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275the version
readHeader()
The header of the file contains the following data:
2B DA (US-ASCII) 1B File type ID (1: carrier data, 2:some other data.... etc) 2B Header length - the total size of the header including the preceding bytes 2B Length of copyright text ?B Copyright (US-ASCII) "(c) Copyright 2013 - DeviceAtlas Limited" 24B Creation date (US-ASCII) "2013-08-07T15:36:44+0000" 1B Version, major 1B Version, minor 4B Licence ID 4B CRC-32 - all data after first bucket offset
checkFileTypeGetHeaderLength( $startBytes) : integer
Check the first few bytes to make sure we are opening a Carrier Identification file. Also get the length of the header.
$startBytes |
header length
readBuckets()
Each bucket is comprised of the following. The BucketHandler is responsible for actually parsing the data in each bucket. This method keeps reading until either the end of the file or until all necessary buckets have been read. It will skip buckets with IDs it does not recognise to hopefully future proof the API against possible additions to the data file
Bucket structure:
2B Bucket ID 4B CRC-32 checksum - NOTE: unsigned int! 4B Length of the data ?B Data