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

Public Member Functions

 __construct ($type, $name, $default=null, $message=null, $isList=false)
 
 trimDuringClean ()
 
 getAliases ()
 
 hasAlias ($alias)
 
 hasDependency ($dependency)
 
 getAllowedValues ()
 
 setDefault ($default, $manipulate=true)
 
 getDefault ()
 
 getMessage ()
 
 setMessage ($message)
 
 setDoManipulationOfDefault ($doOrDoNotThereIsNoTry)
 
 shouldManipulateDefault ()
 
 addAliases ($aliases)
 
 addDependencies ($dependencies)
 
 getName ()
 
 getTypeMessage ()
 
 getDependencies ()
 
 isRequired ()
 
 isList ()
 
 getDelimiter ()
 
 setDelimiter ($delimiter)
 
 setArrayValues (array $param)
 
 format (IParam $param, array &$definitions, array $params)
 
 getType ()
 
 getValueParser ()
 
 getValueValidator ()
 
 setValueParser (ValueParser $parser)
 
 setValueValidator (ValueValidator $validator)
 
 setValidationCallback ($validationFunction)
 
 getValidationCallback ()
 
 getOptions ()
 

Static Public Member Functions

static getCleanDefinitions (array $definitions)
 

Static Public Attributes

static $acceptOverriding = false
 
static $accumulateParameterErrors = false
 

Protected Member Functions

 postConstruct ()
 
 formatList (IParam $param, array &$definitions, array $params)
 
 formatValue ($value, IParam $param, array &$definitions, array $params)
 

Protected Attributes

 $trimValue = null
 
 $applyManipulationsToDefault = true
 
 $dependencies = []
 
 $default
 
 $name
 
 $isList
 
 $delimiter = ','
 
 $aliases = []
 
 $message = 'validator-message-nodesc'
 
 $options = []
 
 $parser = null
 
 $validator = null
 
 $validationFunction = null
 
 $type
 

Detailed Description

Parameter definition. Specifies what kind of values are accepted, how they should be validated, how they should be formatted, what their dependencies are and how they should be described.

Try to avoid using this interface outside of ParamProcessor for anything else then defining parameters. In particular, do not derive from this class to implement methods such as formatValue.

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\ParamDefinition::__construct (   $type,
  $name,
  $default = null,
  $message = null,
  $isList = false 
)

Constructor.

Since
1.0
Parameters
string$type
string$name
mixed$defaultUse null for no default (which makes the parameter required)
string$message
boolean$isList

Member Function Documentation

ParamProcessor\ParamDefinition::addAliases (   $aliases)
See Also
IParamDefinition::addAliases
Since
1.0
Parameters
string|string[]$aliases

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::addDependencies (   $dependencies)
See Also
IParamDefinition::addDependencies
Since
1.0
Parameters
string|string[]$dependencies

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::format ( IParam  $param,
array &  $definitions,
array  $params 
)
See Also
IParamDefinition::format
Since
1.0
Deprecated:
Parameters
IParam$param
IParamDefinition[]$definitions
IParam[]$params

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::formatList ( IParam  $param,
array &  $definitions,
array  $params 
)
protected

Formats the parameters values to their final result.

Since
1.0
Deprecated:
Parameters
$paramIParam
$definitionsarray of IParamDefinition
$paramsarray of IParam
ParamProcessor\ParamDefinition::formatValue (   $value,
IParam  $param,
array &  $definitions,
array  $params 
)
protected

Formats the parameter value to it's final result.

Since
1.0
Deprecated:
Parameters
mixed$value
IParam$param
IParamDefinition[]$definitions
IParam[]$params
Returns
mixed
ParamProcessor\ParamDefinition::getAliases ( )
See Also
IParamDefinition::getAliases
Since
1.0
Returns
string[]

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getAllowedValues ( )

Returns the list of allowed values, or an empty array if there is no such restriction.

Since
1.0
Returns
array
static ParamProcessor\ParamDefinition::getCleanDefinitions ( array  $definitions)
static

Returns a cleaned version of the list of parameter definitions. This includes having converted all supported definition types to ParamDefinition classes and having all keys set to the names of the corresponding parameters.

Since
1.0
Parameters
IParamDefinition[]$definitions
Returns
IParamDefinition[]
Exceptions
Exception
ParamProcessor\ParamDefinition::getDefault ( )
See Also
IParamDefinition::getDefault
Since
1.0
Returns
mixed

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getDelimiter ( )
See Also
IParamDefinition::getDelimiter
Since
1.0
Returns
string

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getDependencies ( )
See Also
IParamDefinition::getDependencies
Since
1.0
Returns
string[]

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getMessage ( )
See Also
IParamDefinition::getMessage
Since
1.0
Returns
string

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getName ( )
See Also
IParamDefinition::getName
Since
1.0
Returns
string

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getOptions ( )
Since
0.1
Returns
array
ParamProcessor\ParamDefinition::getType ( )
See Also
IParamDefinition::getType
Since
1.0
Returns
string

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getTypeMessage ( )

Returns a message key for a message describing the parameter type.

Since
1.0
Returns
string

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getValidationCallback ( )
See Also
IParamDefinition::getValidationCallback
Since
1.0
Returns
callable|null

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getValueParser ( )
See Also
IParamDefinition::getValueParser
Since
1.0
Returns
ValueParser

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::getValueValidator ( )
See Also
IParamDefinition::getValueValidator
Since
1.0
Returns
ValueValidator

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::hasAlias (   $alias)
See Also
IParamDefinition::hasAlias
Since
1.0
Parameters
string$alias
Returns
boolean

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::hasDependency (   $dependency)
See Also
IParamDefinition::hasDependency
Since
1.0
Parameters
string$dependency
Returns
boolean

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::isList ( )
See Also
IParamDefinition::isList
Since
1.0
Returns
boolean

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::isRequired ( )
See Also
IParamDefinition::isRequired
Since
1.0
Returns
boolean

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::postConstruct ( )
protected

Allows deriving classed to do additional stuff on instance construction without having to get and pass all the constructor arguments.

Since
1.0
ParamProcessor\ParamDefinition::setArrayValues ( array  $param)
See Also
IParamDefinition::setArrayValues
Since
1.0
Parameters
array$param

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setDefault (   $default,
  $manipulate = true 
)
See Also
IParamDefinition::setDefault
Since
1.0
Parameters
mixed$default
boolean$manipulateShould the default be manipulated or not? Since 0.4.6.

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setDelimiter (   $delimiter)
See Also
IParamDefinition::setDelimiter
Since
1.0
Parameters
$delimiterstring

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setDoManipulationOfDefault (   $doOrDoNotThereIsNoTry)
See Also
IParamDefinition::setDoManipulationOfDefault
Since
1.0
Parameters
boolean$doOrDoNotThereIsNoTry

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setMessage (   $message)
See Also
IParamDefinition::setMessage
Since
1.0
Parameters
string$message

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setValidationCallback (   $validationFunction)
See Also
IParamDefinition::setValidationCallback
Since
1.0
Parameters
callable$validationFunction

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setValueParser ( ValueParser  $parser)
See Also
IParamDefinition::setValueParser
Since
1.0
Parameters
ValueParser$parser

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::setValueValidator ( ValueValidator  $validator)
See Also
IParamDefinition::setValueValidator
Since
1.0
Parameters
ValueValidator$validator

Implements ParamProcessor\IParamDefinition.

ParamProcessor\ParamDefinition::shouldManipulateDefault ( )
ParamProcessor\ParamDefinition::trimDuringClean ( )
See Also
IParamDefinition::trimDuringClean
Since
1.0
Returns
boolean|null

Implements ParamProcessor\IParamDefinition.


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