From 448b0f5e28e3c52648dfbb4a3c364760fe6be4d5 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Wed, 11 Jan 2012 10:19:07 +1030 Subject: [PATCH] Remove _getError(), we've got exceptions --- HTTP/Download2.php | 51 +--------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/HTTP/Download2.php b/HTTP/Download2.php index 5813bba..d62e8af 100644 --- a/HTTP/Download2.php +++ b/HTTP/Download2.php @@ -269,10 +269,6 @@ function __construct($params = array()) */ function setParams($params) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } foreach((array) $params as $param => $value){ $method = 'set'. $param; @@ -303,10 +299,6 @@ function setParams($params) */ function setFile($file, $send_error = true) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } $file = realpath($file); if (!is_file($file)) { if ($send_error) { @@ -360,10 +352,6 @@ function setData($data = null) */ function setResource($handle = null) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if (!isset($handle)) { $this->handle = null; $this->size = 0; @@ -396,10 +384,6 @@ function setResource($handle = null) */ function setGzip($gzip = false) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if ($gzip && !PEAR::loadExtension('zlib')){ throw new HTTP_Download2_Exception( 'GZIP compression (ext/zlib) not available.', @@ -486,10 +470,6 @@ function setETag($etag = null) */ function setBufferSize($bytes = 2097152) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if (0 >= $bytes) { throw new HTTP_Download2_Exception( 'Buffer size must be greater than 0 bytes ('. $bytes .' given)', @@ -590,10 +570,6 @@ function setContentDisposition( $disposition = HTTP_DOWNLOAD2_ATTACHMENT, */ function setContentType($content_type = 'application/x-octetstream') { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if (!preg_match('/^[a-z]+\w*\/[a-z]+[\w.;= -]*$/', $content_type)) { throw new HTTP_Download2_Exception( "Invalid content type '$content_type' supplied.", @@ -624,10 +600,6 @@ function setContentType($content_type = 'application/x-octetstream') */ function guessContentType() { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if (class_exists('MIME_Type') || @include_once 'MIME/Type.php') { if (PEAR::isError($mime_type = MIME_Type::autoDetect($this->file))) { throw new HTTP_Download2_Exception($mime_type->getMessage(), @@ -670,10 +642,6 @@ function guessContentType() */ function send($autoSetContentDisposition = true) { - $error = $this->_getError(); - if ($error !== null) { - return $error; - } if (headers_sent()) { throw new HTTP_Download2_Exception( 'Headers already sent.', @@ -1213,21 +1181,4 @@ function sleep() } } - /** - * Returns and clears startup error - * - * @return NULL|PEAR_Error startup error if one exists - * @access protected - */ - function _getError() - { - $error = null; - if (PEAR::isError($this->_error)) { - $error = $this->_error; - $this->_error = null; - } - return $error; - } - // }}} -} -?> +} \ No newline at end of file