\DeviceAtlas\DataFileDataFileDownloader

Downloads the data file from a provided URL.

Summary

Methods
Properties
Constants
__construct()
downloadDataFile()
No public properties found
XMSG_DOWNLOAD_URL_ERROR
XMSG_DOWNLOAD_ERROR
XMSG_ERROR_SAVING_DATA_FILE
XMSG_MD5_VALIDATION_FAILED
XMSG_UNSUPPORTED_CONTENT_TYPE
No protected methods found
No protected properties found
N/A
parseHeaders()
validateMd5()
saveDataFile()
decompressDataStream()
getHttpOptions()
$dataFile
N/A

Constants

XMSG_DOWNLOAD_URL_ERROR

XMSG_DOWNLOAD_URL_ERROR = "Please check data file url is a valid url."

XMSG_DOWNLOAD_ERROR

XMSG_DOWNLOAD_ERROR = "Error downloading data file due to: %s. Please check if the licence key and data file url is valid and correct respectively."

XMSG_ERROR_SAVING_DATA_FILE

XMSG_ERROR_SAVING_DATA_FILE = "Error saving data file. Please check you have write permissions to: %s"

XMSG_MD5_VALIDATION_FAILED

XMSG_MD5_VALIDATION_FAILED = "Data file MD5 validation failed. Header validated was: %s."

XMSG_UNSUPPORTED_CONTENT_TYPE

XMSG_UNSUPPORTED_CONTENT_TYPE = "Content type %s is not supported. The following content types are supported: %s. Note: Zip content type supported only when zip extension is installed."

Properties

$dataFile

$dataFile : 

Type

Methods

__construct()

__construct(  $dataFile) 

Parameters

$dataFile
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 1275

downloadDataFile()

downloadDataFile(  $url) : boolean

Downloads the data file and performs MD5 validation if configured to do so.

Parameters

$url

Throws

\DeviceAtlas\Exception\DataLoadingException

Returns

boolean

parseHeaders()

parseHeaders(  $rawHeaders) : array

Parse response header.

Parameters

$rawHeaders
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 1275

Returns

array

validateMd5()

validateMd5(  $headerMd5,   $inputStream) 

Validate the response 'content-md5' header with the downloaded stream md5

Parameters

$headerMd5
$inputStream

Throws

\DeviceAtlas\Exception\DataLoadingException

if validation fails.

saveDataFile()

saveDataFile(  $inputStream,   $content_type) : boolean

Saves the data file to a temporary file path. This file will be persisted to a permanent location if it is loaded into the API successfully.

Parameters

$inputStream
$content_type

Throws

\DeviceAtlas\Exception\DataLoadingException

Returns

boolean

decompressDataStream()

decompressDataStream(  $content_type) : boolean

Decompress the data if necessary.

Parameters

$content_type

Throws

\DeviceAtlas\Exception\DataLoadingException

Returns

boolean

getHttpOptions()

getHttpOptions() : array<mixed,array>

Prepare the http context options.

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 1275

Returns

array<mixed,array>