diff --git a/src/CloudApp/API.php b/src/CloudApp/API.php index 4ed105b..4899ccf 100644 --- a/src/CloudApp/API.php +++ b/src/CloudApp/API.php @@ -19,7 +19,7 @@ */ namespace CloudApp; -use CloudApp\Cloud_Exception; +use CloudApp\Exception; // Type definitions define('CLOUD_API_TYPE_ALL', null); @@ -36,7 +36,7 @@ * * @author Matthias Plappert */ -class Cloud_API +class API { /** * The email address of an user. Used for authentication. @@ -176,17 +176,17 @@ public function addBookmark($url, $name = '', $private = null) { public function addFile($path) { // Check if file exists if (!file_exists($path)) { - throw new Cloud_Exception('File at path \'' . $path . '\' not found', CLOUD_EXCEPTION_FILE_NOT_FOUND); + throw new Exception('File at path \'' . $path . '\' not found', CLOUD_EXCEPTION_FILE_NOT_FOUND); } // Check if path points to a file if (!is_file($path)) { - throw new Cloud_Exception('Path \'' . $path . '\' doesn\'t point to a file', CLOUD_EXCEPTION_FILE_INVALID); + throw new Exception('Path \'' . $path . '\' doesn\'t point to a file', CLOUD_EXCEPTION_FILE_INVALID); } // Check if file is readable if (!is_readable($path)) { - throw new Cloud_Exception('File at path \'' . $path . '\' isn\'t readable', CLOUD_EXCEPTION_FILE_NOT_READABLE); + throw new Exception('File at path \'' . $path . '\' isn\'t readable', CLOUD_EXCEPTION_FILE_NOT_READABLE); } // Request S3 data @@ -194,7 +194,7 @@ public function addFile($path) { // Check if we can upload if(isset($s3->num_remaining) && $s3->num_remaining < 1) { - throw new Cloud_Exception('Insufficient uploads remaining. Please consider upgrading to CloudApp Pro', CLOUD_EXCEPTION_PRO); + throw new Exception('Insufficient uploads remaining. Please consider upgrading to CloudApp Pro', CLOUD_EXCEPTION_PRO); } // Create body and upload file @@ -312,7 +312,7 @@ private function _execute($api_url, $body = null, $expected_code = 200, $method // Check for status code and close connection $status_code = curl_getinfo($this->_ch, CURLINFO_HTTP_CODE); if ($status_code != $expected_code) { - throw new Cloud_Exception('Invalid response. Expected HTTP status code \'' . $expected_code . '\' but received \'' . $status_code . '\'', CLOUD_EXCEPTION_INVALID_RESPONSE); + throw new Exception('Invalid response. Expected HTTP status code \'' . $expected_code . '\' but received \'' . $status_code . '\'', CLOUD_EXCEPTION_INVALID_RESPONSE); } // Decode JSON and return result @@ -343,7 +343,7 @@ private function _upload($url, $body, $expected_code = 303) { // Check for status code and close connection $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($status_code != $expected_code) { - throw new Cloud_Exception('Invalid response. Expected HTTP status code \'' . $expected_code . '\' but received \'' . $status_code . '\'', CLOUD_EXCEPTION_INVALID_RESPONSE); + throw new Exception('Invalid response. Expected HTTP status code \'' . $expected_code . '\' but received \'' . $status_code . '\'', CLOUD_EXCEPTION_INVALID_RESPONSE); } // Close @@ -355,7 +355,7 @@ private function _upload($url, $body, $expected_code = 303) { return trim(urldecode($matches[1])); } else { // Throw exception - throw new Cloud_Exception('Invalid response. Location header is missing.', CLOUD_EXCEPTION_INVALID_RESPONSE); + throw new Exception('Invalid response. Location header is missing.', CLOUD_EXCEPTION_INVALID_RESPONSE); } } } diff --git a/src/CloudApp/Exception.php b/src/CloudApp/Exception.php index 553602c..5135bda 100644 --- a/src/CloudApp/Exception.php +++ b/src/CloudApp/Exception.php @@ -31,6 +31,6 @@ * * @author Matthias Plappert */ -class Cloud_Exception extends \Exception { } +class Exception extends \Exception { } ?>