BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
ParamProcessor\Param Class Reference
Inheritance diagram for ParamProcessor\Param:
Collaboration diagram for ParamProcessor\Param:

Public Member Functions

 __construct (IParamDefinition $definition)
 
 setUserValue ($paramName, $paramValue, Options $options)
 
 setValue ($value)
 
 process (array &$definitions, array $params, Options $options)
 
 getValueParser (Options $options)
 
 getOriginalName ()
 
 getOriginalValue ()
 
 getErrors ()
 
 wasSetToDefault ()
 
 hasFatalError ()
 
 getDefinition ()
 
getValue ()
 
 isRequired ()
 
 getName ()
 
 getAliases ()
 

Static Public Attributes

static $accumulateParameterErrors = false
 

Protected Member Functions

 cleanValue (Options $options)
 
 parseAndValidate (Options $options)
 
 parseAndValidateValue (ValueParser $parser, $value)
 
 registerProcessingError ($message)
 
 newProcessingError ($message)
 
 validateValue ($value)
 
 setToDefaultIfNeeded ()
 
 setToDefault ()
 

Protected Attributes

 $originalName
 
 $originalValue
 
 $value
 
 $setCount = 0
 
 $errors = []
 
 $defaulted = false
 
 $definition
 

Detailed Description

Parameter class, representing the "instance" of a parameter. Holds a ParamDefinition, user provided input (name & value) and processing state.

NOTE: as of version 1.0, this class is for internal use only!

Since
1.0

GNU GPL v2+

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >

Constructor & Destructor Documentation

ParamProcessor\Param::__construct ( IParamDefinition  $definition)

Constructor.

Since
1.0
Parameters
IParamDefinition$definition

Member Function Documentation

ParamProcessor\Param::cleanValue ( Options  $options)
protected

Sets the $value to a cleaned value of $originalValue.

TODO: the per-parameter lowercaseing and trimming here needs some thought

Since
1.0
Parameters
Options$options
ParamProcessor\Param::getAliases ( )

Returns the parameter name aliases.

Since
1.0
Returns
string[]
ParamProcessor\Param::getDefinition ( )

Returns the IParamDefinition this IParam was constructed from.

Since
1.0
Returns
IParamDefinition
ParamProcessor\Param::getErrors ( )

Returns all validation errors that occurred so far.

Since
1.0
Returns
ProcessingError[]
ParamProcessor\Param::getName ( )

Returns if the name of the parameter.

Since
1.0
Returns
boolean
ParamProcessor\Param::getOriginalName ( )

Returns the original use-provided name.

Since
1.0
Exceptions
Exception
Returns
string
ParamProcessor\Param::getOriginalValue ( )

Returns the original use-provided value.

Since
1.0
Exceptions
Exception
Returns
string
& ParamProcessor\Param::getValue ( )

Returns the parameters value.

Since
1.0
Returns
mixed
ParamProcessor\Param::getValueParser ( Options  $options)
Since
1.0
Parameters
Options$options
Returns
ValueParser
ParamProcessor\Param::hasFatalError ( )
Returns
boolean
ParamProcessor\Param::isRequired ( )

Returns if the parameter is required or not.

Since
1.0
Returns
boolean
ParamProcessor\Param::newProcessingError (   $message)
protected
Since
1.0
Parameters
string$message
Returns
ProcessingError
ParamProcessor\Param::parseAndValidate ( Options  $options)
protected
Since
1.0
Parameters
Options$options
ParamProcessor\Param::parseAndValidateValue ( ValueParser  $parser,
  $value 
)
protected

Parses and validates the provided with with specified parser. The result is returned in an array on success. On fail, false is returned. The result is wrapped in an array since we need to be able to distinguish between the method returning false and the value being false.

Parsing and validation errors get added to $this->errors.

Since
1.0
Parameters
ValueParser$parser
mixed$value
Returns
array|bool
ParamProcessor\Param::process ( array &  $definitions,
array  $params,
Options  $options 
)

Parameter processing entry point. Processes the parameter. This includes parsing, validation and additional formatting.

Since
1.0
Parameters
$definitionsarray of IParamDefinition
$paramsarray of IParam
Options$options
Exceptions
Exception
ParamProcessor\Param::registerProcessingError (   $message)
protected
Since
1.0
Parameters
string$message
ParamProcessor\Param::setToDefault ( )
protected

Sets the parameter value to the default.

Since
1.0
ParamProcessor\Param::setToDefaultIfNeeded ( )
protected

Sets the parameter value to the default if needed.

Since
1.0
ParamProcessor\Param::setUserValue (   $paramName,
  $paramValue,
Options  $options 
)

Sets and cleans the original value and name.

See Also
IParam::setUserValue
Since
1.0
Parameters
string$paramName
string$paramValue
Options$options
Returns
boolean
ParamProcessor\Param::setValue (   $value)

Sets the value.

Since
1.0
Parameters
mixed$value
ParamProcessor\Param::validateValue (   $value)
protected
Since
1.0
Parameters
mixed$value
ParamProcessor\Param::wasSetToDefault ( )

Gets if the parameter was set to it's default.

Since
1.0
Returns
boolean

The documentation for this class was generated from the following file: