Author: Tobias Schlitt
Date: 2006-01-13 14:25:07 +0100 (Fri, 13 Jan 2006)
New Revision: 1827
Log:
- Migrate to new ezcBase* exceptions.
Modified:
packages/ImageAnalysis/trunk/src/analyzer.php
packages/ImageAnalysis/trunk/src/handlers/imagemagick.php
packages/ImageAnalysis/trunk/src/handlers/php.php
Modified: packages/ImageAnalysis/trunk/src/analyzer.php
===================================================================
--- packages/ImageAnalysis/trunk/src/analyzer.php 2006-01-13 13:09:13 UTC
(rev 1826)
+++ packages/ImageAnalysis/trunk/src/analyzer.php 2006-01-13 13:25:07 UTC
(rev 1827)
@@ -138,28 +138,22 @@
*
* @param string $file The file to analyze.
*
- * @throws ezcImageAnalyzerException
- * [EMAIL PROTECTED] ezcImageAnalyzerException::FILE_NOT_READABLE}
+ * @throws ezcBaseFilePermissionException
* If image file is not readable.
- * @throws ezcImageAnalyzerException
- * [EMAIL PROTECTED] ezcImageAnalyzerException::FILE_NOT_EXISTS}
+ * @throws ezcBaseFileNotFoundException
* If image file does not exist.
+ * @throws ezcImageAnalyzerFileNotProcessableException
+ * If the file could not be processed.
*/
public function __construct( $file )
{
- if ( !is_file( $file ) )
+ if ( !file_exists( $file ) || !is_file( $file ) )
{
- throw new ezcImageAnalyzerException(
- "File does not exist <{$file}>.",
- ezcImageAnalyzerException::FILE_NOT_EXISTS
- );
+ throw new ezcBaseFileNotFoundException( $file );
}
if ( !is_readable( $file ) )
{
- throw new ezcImageAnalyzerException(
- "File is not readable <{$file}.",
- ezcImageAnalyzerException::FILE_NOT_READABLE
- );
+ throw new ezcBaseFilePermissionException( $file,
ezcBaseFileException::READ );
}
$this->filePath = $file;
$this->isAnalyzed = false;
@@ -214,11 +208,14 @@
/**
* Sets the property $name to $value.
*
- * @throws ezcBasePropertyNotFoundException if the property does not exist.
- * @throws ezcBasePropertyReadOnlyException if the property cannot be
modified.
* @param string $name
* @param mixed $value
* @return void
+ *
+ * @throws ezcBasePropertyNotFoundException
+ * If the property does not exist.
+ * @throws ezcBasePropertyPermissionException
+ * If the property cannot be modified.
*/
public function __set( $name, $value )
{
@@ -226,7 +223,7 @@
{
case 'mime':
case 'data':
- throw new ezcBasePropertyReadOnlyException( $name );
+ throw new ezcBasePropertyPermissionException( $name,
ezcBasePropertyPermissionException::READ );
default:
throw new ezcBasePropertyNotFoundException( $name );
}
@@ -235,10 +232,11 @@
/**
* Returns the property $name.
*
- * @throws ezcBasePropertyNotFoundException if the property does not exist.
- *
* @param string $name Name of the property to access.
* @return mixed Value of the desired property.
+ *
+ * @throws ezcBasePropertyNotFoundException
+ * If the property does not exist.
*/
public function __get( $name )
{
@@ -309,6 +307,8 @@
*
* @throws ezcImageAnalyzerFileNotProcessableException
* If the no handler is capable to analyze the given image file.
+ * @throws ezcBaseFileIoException
+ * If an error occurs while the file is read.
*/
public function analyzeImage()
{
Modified: packages/ImageAnalysis/trunk/src/handlers/imagemagick.php
===================================================================
--- packages/ImageAnalysis/trunk/src/handlers/imagemagick.php 2006-01-13
13:09:13 UTC (rev 1826)
+++ packages/ImageAnalysis/trunk/src/handlers/imagemagick.php 2006-01-13
13:25:07 UTC (rev 1827)
@@ -223,14 +223,11 @@
* @param string $file The file to analyze.
* @return ezcImageAnalyzerData
*
- * @throws ezcImageAnalyzerException
- * [EMAIL PROTECTED] ezcImageAnalyzerException::FILE_NOT_READABLE}
- * If image file is not readable.
* @throws ezcImageAnalyzerFileNotProcessableException
* If image file can not be processed.
*
- * @todo Why does ImageMagick return the wron file size on TIFF with
comments?
- * @todo Check for translucent transparency
+ * @todo Why does ImageMagick return the wrong file size on TIFF with
comments?
+ * @todo Check for translucent transparency.
*/
public function analyzeImage( $file )
{
Modified: packages/ImageAnalysis/trunk/src/handlers/php.php
===================================================================
--- packages/ImageAnalysis/trunk/src/handlers/php.php 2006-01-13 13:09:13 UTC
(rev 1826)
+++ packages/ImageAnalysis/trunk/src/handlers/php.php 2006-01-13 13:25:07 UTC
(rev 1827)
@@ -103,9 +103,6 @@
* @param string $file The file to analyze.
* @return ezcImageAnalyzerData
*
- * @throws ezcImageAnalyzerException
- * [EMAIL PROTECTED] ezcImageAnalyzerException::FILE_NOT_READABLE}
- * If image file is not readable.
* @throws ezcImageAnalyzerFileNotProcessableException
* If image file can not be processed.
*/
@@ -242,9 +239,8 @@
* @param ezcImageAnalyzerData The data struct to fill.
* @return ezcImageAnalyzerData The filled data struct.
*
- * @throws ezcImageAnalyzerException
- * [EMAIL PROTECTED] ezcImageAnalyzerException::FILE_NOT_READABLE}
- * If image file is not readable.
+ * @throws ezcBaseFileIoException
+ * If image file could not be read.
* @throws ezcImageAnalyzerFileNotProcessableException
* If image file can not be processed.
*/
@@ -252,10 +248,7 @@
{
if ( ( $fp = fopen( $file, 'rb' ) ) === false )
{
- throw new ezcImageAnalyzerException(
- "Could not open file <{$file}> for reading.",
- ezcImageAnalyzerException::FILE_NOT_READABLE
- );
+ throw new ezcBaseFileIoException( $file,
ezcBaseFileException::READ );
}
// Read GIF header
@@ -264,7 +257,7 @@
if ( $magic != 'GIF87a' &&
$magic != 'GIF89a' )
{
- throw new ezcImageAnalyzerFileNotProcessableException( $file,'Not
a valid GIF image file' );
+ throw new ezcImageAnalyzerFileNotProcessableException( $file, 'Not
a valid GIF image file' );
}
$info = array();
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components