Author: Tobias Schlitt Date: 2007-04-07 15:37:42 +0200 (Sat, 07 Apr 2007) New Revision: 4823
Log: - Missing new operator in ezcConsoleQuestioDialog. - Made all attributes of ezcConsoleQuestionDialogCollectionValidator properties. Modified: trunk/ConsoleTools/src/dialog/question_dialog.php trunk/ConsoleTools/src/dialog/validators/question_dialog_collection.php Modified: trunk/ConsoleTools/src/dialog/question_dialog.php =================================================================== --- trunk/ConsoleTools/src/dialog/question_dialog.php 2007-04-07 13:29:40 UTC (rev 4822) +++ trunk/ConsoleTools/src/dialog/question_dialog.php 2007-04-07 13:37:42 UTC (rev 4823) @@ -130,7 +130,7 @@ ezcConsoleQuestionDialogCollectionValidator::CONVERT_LOWER ); - return ezcConsoleQuestionDialog( $out, $opts ); + return new ezcConsoleQuestionDialog( $out, $opts ); } /** Modified: trunk/ConsoleTools/src/dialog/validators/question_dialog_collection.php =================================================================== --- trunk/ConsoleTools/src/dialog/validators/question_dialog_collection.php 2007-04-07 13:29:40 UTC (rev 4822) +++ trunk/ConsoleTools/src/dialog/validators/question_dialog_collection.php 2007-04-07 13:37:42 UTC (rev 4823) @@ -19,6 +19,10 @@ * * @property array $collection * The collection of valid answers. + * @property mixed $default + * Default value. + * @property int $conversion + * ezcConsoleQuestionDialogCollectionValidator::TYPE_*. */ class ezcConsoleQuestionDialogCollectionValidator implements ezcConsoleQuestionDialogValidator { @@ -30,23 +34,11 @@ */ protected $properties = array( "collection" => array(), + "default" => null, + "conversion" => self::CONVERT_NONE, ); /** - * Default value. - * - * @var mixed - */ - protected $default; - - /** - * Conversion for the result. One of ezcConsoleQuestionDialogCollectionValidator::CONVERT_*. - * - * @var int - */ - protected $conversion; - - /** * Create a new question dialog collection validator. * * @param array $collection The collection to validate against. @@ -55,10 +47,6 @@ */ public function __construct( array $collection, $default = null, $conversion = self::CONVERT_NONE ) { - if ( $conversion !== self::CONVERT_NONE && $conversion !== self::CONVERT_UPPER && $conversion !== self::CONVERT_LOWER ) - { - throw new ezcBaseValueException( "type", $type, "ezcConsoleQuestionDialogCollectionValidator::CONVERT_*" ); - } $this->collection = $collection; $this->default = $default; $this->conversion = $conversion; @@ -155,6 +143,18 @@ throw new ezcBaseValueException( $propertyName, $propertyValue, "array" ); } break; + case "default": + if ( is_scalar( $propertyValue ) === false && $propertyValue !== null ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, "scalar" ); + } + break; + case "conversion": + if ( $propertyValue !== self::CONVERT_NONE && $propertyValue !== self::CONVERT_UPPER && $propertyValue !== self::CONVERT_LOWER ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, "ezcConsoleQuestionDialogCollectionValidator::CONVERT_*" ); + } + break; default: throw new ezcBasePropertyNotFoundException( $propertyName ); } -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components