From 79f6a34f61ff9dc845843ead664059d8e0be9b98 Mon Sep 17 00:00:00 2001 From: Synchro Date: Wed, 23 Apr 2014 14:12:22 +0200 Subject: [PATCH] Make class more testable --- UAS/Parser.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/UAS/Parser.php b/UAS/Parser.php index 77112cc..45040fe 100755 --- a/UAS/Parser.php +++ b/UAS/Parser.php @@ -477,10 +477,10 @@ protected function getContents($url, $timeout = 300) $headers = array(); if (array_key_exists('wrapper_data', $res) && array_key_exists('headers', $res['wrapper_data']) ) { $headers = $res['wrapper_data']['headers']; - } + } elseif (array_key_exists('wrapper_data', $res) ) { $headers = $res['wrapper_data']; - } + } if( !empty($headers) ) { foreach ($headers as $d) { if ($d == 'Content-Encoding: gzip') { //Data was compressed @@ -623,4 +623,64 @@ public function getDoDownloads() public function setDoDownloads($doDownloads) { $this->doDownloads = (boolean)$doDownloads; } + + /** + * Get the download URL for the ini file + * @return string + */ + public function getIniUrl() + { + return self::$ini_url; + } + + /** + * Set the download URL for the ini file + * @param string $url + */ + public function setIniUrl($url) + { + if (filter_var($url, FILTER_VALIDATE_URL)) { + self::$ini_url = $url; + } + } + + /** + * Get the download URL for the version file + * @return string + */ + public function getVerUrl() + { + return self::$ver_url; + } + + /** + * Set the download URL for the version file + * @param string $url + */ + public function setVerUrl($url) + { + if (filter_var($url, FILTER_VALIDATE_URL)) { + self::$ver_url = $url; + } + } + + /** + * Get the download URL for the checksum file + * @return string + */ + public function getMd5Url() + { + return self::$md5_url; + } + + /** + * Set the download URL for the checksum file + * @param string $url + */ + public function setMd5Url($url) + { + if (filter_var($url, FILTER_VALIDATE_URL)) { + self::$md5_url = $url; + } + } }