PHP Класс Symfony\Component\Config\Definition\PrototypedArrayNode

Автор: Johannes M. Schmitt ([email protected])
Наследование: extends Symfony\Component\Config\Definition\ArrayNode
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$defaultChildren
$defaultValue
$keyAttribute
$minNumberOfElements
$prototype
$removeKeyAttribute

Открытые методы

Метод Описание
addChild ( Symfony\Component\Config\Definition\NodeInterface $node ) Disable adding concrete children for prototyped nodes.
getDefaultValue ( ) : array Retrieves the default value.
getKeyAttribute ( ) : string Retrieves the name of the attribute which value should be used as key.
getPrototype ( ) : Symfony\Component\Config\Definition\PrototypeNodeInterface Retrieves the prototype.
hasDefaultValue ( ) : boolean Checks if the node has a default value.
setAddChildrenIfNoneSet ( integer | string | array | null $children = ['defaults'] ) Adds default children when none are set.
setDefaultValue ( string $value ) Sets the default value of this node.
setKeyAttribute ( string $attribute, boolean $remove = true ) Sets the attribute which value is to be used as key.
setMinNumberOfElements ( integer $number ) Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
setPrototype ( Symfony\Component\Config\Definition\PrototypeNodeInterface $node ) Sets the node prototype.

Защищенные методы

Метод Описание
finalizeValue ( mixed $value ) : mixed Finalizes the value of this node.
mergeValues ( mixed $leftSide, mixed $rightSide ) : mixed Merges values together.
normalizeValue ( mixed $value ) : mixed Normalizes the value.

Приватные методы

Метод Описание
getPrototypeForChild ( string $key ) : mixed Returns a prototype for the child node that is associated to $key in the value array.

Описание методов

addChild() публичный Метод

Disable adding concrete children for prototyped nodes.
public addChild ( Symfony\Component\Config\Definition\NodeInterface $node )
$node Symfony\Component\Config\Definition\NodeInterface The child node to add

finalizeValue() защищенный Метод

Finalizes the value of this node.
protected finalizeValue ( mixed $value ) : mixed
$value mixed
Результат mixed The finalized value

getDefaultValue() публичный Метод

The default value could be either explicited or derived from the prototype default value.
public getDefaultValue ( ) : array
Результат array The default value

getKeyAttribute() публичный Метод

Retrieves the name of the attribute which value should be used as key.
public getKeyAttribute ( ) : string
Результат string The name of the attribute

getPrototype() публичный Метод

Retrieves the prototype.
public getPrototype ( ) : Symfony\Component\Config\Definition\PrototypeNodeInterface
Результат Symfony\Component\Config\Definition\PrototypeNodeInterface The prototype

hasDefaultValue() публичный Метод

Checks if the node has a default value.
public hasDefaultValue ( ) : boolean
Результат boolean

mergeValues() защищенный Метод

Merges values together.
protected mergeValues ( mixed $leftSide, mixed $rightSide ) : mixed
$leftSide mixed The left side to merge
$rightSide mixed The right side to merge
Результат mixed The merged values

normalizeValue() защищенный Метод

Normalizes the value.
protected normalizeValue ( mixed $value ) : mixed
$value mixed The value to normalize
Результат mixed The normalized value

setAddChildrenIfNoneSet() публичный Метод

Adds default children when none are set.
public setAddChildrenIfNoneSet ( integer | string | array | null $children = ['defaults'] )
$children integer | string | array | null The number of children|The child name|The children names to be added

setDefaultValue() публичный Метод

Sets the default value of this node.
public setDefaultValue ( string $value )
$value string

setKeyAttribute() публичный Метод

This is useful when you have an indexed array that should be an associative array. You can select an item from within the array to be the key of the particular item. For example, if "id" is the "key", then: array( array('id' => 'my_name', 'foo' => 'bar'), ); becomes array( 'my_name' => array('foo' => 'bar'), ); If you'd like "'id' => 'my_name'" to still be present in the resulting array, then you can set the second argument of this method to false.
public setKeyAttribute ( string $attribute, boolean $remove = true )
$attribute string The name of the attribute which value is to be used as a key
$remove boolean Whether or not to remove the key

setMinNumberOfElements() публичный Метод

Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
public setMinNumberOfElements ( integer $number )
$number integer

setPrototype() публичный Метод

Sets the node prototype.
public setPrototype ( Symfony\Component\Config\Definition\PrototypeNodeInterface $node )
$node Symfony\Component\Config\Definition\PrototypeNodeInterface

Описание свойств

$defaultChildren защищенное свойство

protected $defaultChildren

$defaultValue защищенное свойство

protected $defaultValue

$keyAttribute защищенное свойство

protected $keyAttribute

$minNumberOfElements защищенное свойство

protected $minNumberOfElements

$prototype защищенное свойство

protected $prototype

$removeKeyAttribute защищенное свойство

protected $removeKeyAttribute