Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConsoleQuestionDialogCollectionValidator

ConsoleTools::ezcConsoleQuestionDialogCollectionValidator

Class ezcConsoleQuestionDialogCollectionValidator

Validator class to validate against a set of valid results.

This validator class, for ezcConsoleQuestionDialog objects, validates a given result against a set of predefined values.

Source for this file: /ConsoleTools/src/dialog/validators/question_dialog_collection.php

Implements interfaces:

Version:   //autogen//

Descendants

Child Class Description
ezcConsoleQuestionDialogMappingValidator Validator class to map certain results to others.

Properties

array read/write $collection
The collection of valid answers.
int read/write $conversion
ezcConsoleDialogValidator::CONVERT_NONE (default) or ezcConsoleDialogValidator::CONVERT_LOWER or ezcConsoleDialogValidator::CONVERT_UPPER.
mixed read/write $default
Default value.

Member Variables

protected array $properties = array(
"collection" => array(),"default"=>null,"conversion"=>self::CONVERT_NONE,)

Properties.

Method Summary

public void __construct( $collection , [ $default = null] , [ $conversion = self::CONVERT_NONE] )
Creates a new question dialog collection validator.
public mixed fixup( $result )
Returns a fixed version of the result, if possible.
public string getResultString( )
Returns a string representing valid results.
public bool validate( $result )
Returns if the given result is valid.

Methods

__construct

void __construct( $collection , [mixed $default = null] , [int $conversion = self::CONVERT_NONE] )

Creates a new question dialog collection validator.

Creates a new question dialog collection validator, which validates the result specified by the user against an array of valid results ($collection). If not value is provided by the user a possibly set $default value is used instead. The $conversion parameter can optionally define a conversion to be performed on the result before validating it. Valid conversions are defined by the CONVERT_* constants in this class.

Parameters:
Name Type Description
$collection array The collection of valid results.
$default mixed Optional default value.
$conversion int CONVERT_* constant.
Redefined in descendants as:
Method Description
ezcConsoleQuestionDialogMappingValidator::__construct() Creates a new question dialog mapping validator. 

fixup

mixed fixup( mixed $result )

Returns a fixed version of the result, if possible.

Converts the given result according to the conversion defined in the $conversion property.

Parameters:
Name Type Description
$result mixed The received result.
Implementation of:
Method Description
ezcConsoleDialogValidator::fixup() Returns a fixed version of the result, if possible.
Redefined in descendants as:
Method Description
ezcConsoleQuestionDialogMappingValidator::fixup() Returns a fixed version of the result, if possible. 

getResultString

string getResultString( )

Returns a string representing valid results.

Returns the string that will be displayed with the question to indicate valid results to the user and a possibly set default, if available.

Implementation of:
Method Description
ezcConsoleQuestionDialogValidator::getResultString() Returns a string of possible results to be displayed with the question.

validate

bool validate( mixed $result )

Returns if the given result is valid.

Returns if the result is in the $collection array.

Parameters:
Name Type Description
$result mixed The received result.
Implementation of:
Method Description
ezcConsoleDialogValidator::validate() Returns if the given result is valid.
Documentation generated by phpDocumentor 1.4.3