Author: Tobias Schlitt
Date: 2006-01-13 14:05:52 +0100 (Fri, 13 Jan 2006)
New Revision: 1825
Log:
- Migrate to new ezcBase* exceptions.
Modified:
packages/ConsoleTools/trunk/src/input/option.php
packages/ConsoleTools/trunk/src/structs/option_rule.php
packages/ConsoleTools/trunk/src/table.php
packages/ConsoleTools/trunk/src/table/row.php
Modified: packages/ConsoleTools/trunk/src/input/option.php
===================================================================
--- packages/ConsoleTools/trunk/src/input/option.php 2006-01-13 13:03:10 UTC
(rev 1824)
+++ packages/ConsoleTools/trunk/src/input/option.php 2006-01-13 13:05:52 UTC
(rev 1825)
@@ -459,13 +459,13 @@
* @param string $key Name of the property.
* @param mixed $val The value for the property.
*
- * @throws ezcBasePropertyReadOnlyException
+ * @throws ezcBasePropertyPermissionException
* If the property you try to access is read-only.
* @return void
*/
public function __set( $key, $val )
{
- throw new ezcBasePropertyReadOnlyException( $key );
+ throw new ezcBasePropertyPermissionException( $key,
ezcBasePropertyPermissionException::READ );
}
/**
Modified: packages/ConsoleTools/trunk/src/structs/option_rule.php
===================================================================
--- packages/ConsoleTools/trunk/src/structs/option_rule.php 2006-01-13
13:03:10 UTC (rev 1824)
+++ packages/ConsoleTools/trunk/src/structs/option_rule.php 2006-01-13
13:05:52 UTC (rev 1825)
@@ -94,6 +94,8 @@
*
* @throws ezcBasePropertyNotFoundException
* If the property tried to access does not exist.
+ * @throws ezcBaseValueException
+ * If the value for a property is not in the correct range.
*
* @param string $propertyName Name of the property to access.
* @return void
@@ -105,14 +107,14 @@
case 'option':
if ( !( $val instanceof ezcConsoleOption ) )
{
- throw new ezcBaseTypeException( 'ezcConsoleOption',
gettype( $val ) );
+ throw new ezcBaseValueException( $propertyName, $val,
'ezcConsoleOption' );
}
$this->properties['option'] = $val;
return;
case 'values':
if ( !is_array( $val ) )
{
- throw new ezcBaseTypeException( 'array', gettype( $val ) );
+ throw new ezcBaseValueException( $propertyName, $val,
'array' );
}
$this->properties['values'] = $val;
return;
Modified: packages/ConsoleTools/trunk/src/table/row.php
===================================================================
--- packages/ConsoleTools/trunk/src/table/row.php 2006-01-13 13:03:10 UTC
(rev 1824)
+++ packages/ConsoleTools/trunk/src/table/row.php 2006-01-13 13:05:52 UTC
(rev 1825)
@@ -81,17 +81,23 @@
/**
* Create a new ezcConsoleProgressbarRow.
* Creates a new ezcConsoleProgressbarRow.
+ *
+ * This method takes any number of [EMAIL PROTECTED] ezcConsoleTableCell}
objects as
+ * parameter, which will be added as table cells to the row in their
+ * specified order.
*
+ * @throws ezcBaseValueException
+ * If a paremeter is not of type [EMAIL PROTECTED]
ezcConsoleTableCell}.
*/
public function __construct()
{
if ( func_num_args() > 0 )
{
- foreach ( func_get_args() as $arg )
+ foreach ( func_get_args() as $id => $arg )
{
if ( !( $arg instanceof ezcConsoleTableCell ) )
{
- throw new ezcBaseTypeException( 'ezcConsoleTableCell',
gettype( $arg ) );
+ throw new ezcBaseValueException( 'Parameter'.$id, $arg,
'ezcConsoleTableCell' );
}
$this->cells[] = $arg;
}
@@ -105,12 +111,15 @@
*
* @param int $offset The offset to check.
* @return bool True when the offset exists, otherwise false.
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric cell ID is requested.
*/
public function offsetExists( $offset )
{
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
return isset( $this->cells[$offset] );
}
@@ -124,6 +133,9 @@
*
* @param int $offset The offset to check.
* @return object(ezcConsoleTableCell)
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric cell ID is requested.
*/
public function offsetGet( $offset )
{
@@ -134,7 +146,7 @@
}
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
if ( !isset( $this->cells[$offset] ) )
{
@@ -151,12 +163,17 @@
* @param int $offset The offset to assign an item to.
* @param object(ezcConsoleTableCell) The item to assign.
* @return void
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric cell ID is requested.
+ * @throws ezcBaseValueException
+ * If the provided value is not of type [EMAIL PROTECTED]
ezcConsoleTableCell}.
*/
public function offsetSet( $offset, $value )
{
if ( !( $value instanceof ezcConsoleTableCell ) )
{
- throw new ezcBaseTypeException( 'ezcConsoleTableCell', gettype(
$value ) );
+ throw new ezcBaseValueException( 'value', $value,
'ezcConsoleTableCell' );
}
if ( !isset( $offset ) )
{
@@ -164,7 +181,7 @@
}
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
$this->cells[$offset] = $value;
}
@@ -176,12 +193,15 @@
*
* @param int $offset The offset to unset the value for.
* @return void
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric cell ID is requested.
*/
public function offsetUnset( $offset )
{
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
if ( isset( $this->cells[$offset] ) )
{
Modified: packages/ConsoleTools/trunk/src/table.php
===================================================================
--- packages/ConsoleTools/trunk/src/table.php 2006-01-13 13:03:10 UTC (rev
1824)
+++ packages/ConsoleTools/trunk/src/table.php 2006-01-13 13:05:52 UTC (rev
1825)
@@ -150,7 +150,7 @@
* @see ezcConsoleTable::$settings
* @see ezcConsoleTable::$options
*
- * @throws ezcBaseConfigException On an invalid setting.
+ * @throws ezcBaseValueException On an invalid setting.
*/
public function __construct( ezcConsoleOutput $outHandler, $width,
ezcConsoleTableOptions $options = null )
{
@@ -194,12 +194,15 @@
*
* @param int $offset The offset to check.
* @return bool True when the offset exists, otherwise false.
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric row ID is requested.
*/
public function offsetExists( $offset )
{
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
return isset( $this->rows[$offset] );
}
@@ -215,6 +218,9 @@
*
* @param int $offset The offset to check.
* @return object(ezcConsoleTableCell)
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric row ID is requested.
*/
public function offsetGet( $offset )
{
@@ -225,7 +231,7 @@
}
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
if ( !isset( $this->rows[$offset] ) )
{
@@ -242,12 +248,17 @@
* @param int $offset The offset to assign an item to.
* @param object(ezcConsoleTableCell) The item to assign.
* @return void
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric row ID is requested.
+ * @throws ezcBaseValueException
+ * If the provided value is not of type [EMAIL PROTECTED]
ezcConsoleTableRow}.
*/
public function offsetSet( $offset, $value )
{
- if ( !( $value instanceof ezcConsoleTableCell ) )
+ if ( !( $value instanceof ezcConsoleTableRow ) )
{
- throw new ezcBaseTypeException( 'ezcConsoleTableCell', gettype(
$value ) );
+ throw new ezcBaseValueException( 'value', $value,
'ezcConsoleTableRow' );
}
if ( !isset( $offset ) )
{
@@ -255,7 +266,7 @@
}
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
$this->rows[$offset] = $value;
}
@@ -267,12 +278,15 @@
*
* @param int $offset The offset to unset the value for.
* @return void
+ *
+ * @throws ezcBaseValueException
+ * If a non numeric row ID is requested.
*/
public function offsetUnset( $offset )
{
if ( !is_int( $offset ) || $offset < 0 )
{
- throw new ezcBaseTypeException( 'int+', gettype( $offset ) );
+ throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' );
}
if ( isset( $this->rows[$offset] ) )
{
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components