class NodeBuilder implements NodeParentInterface

This class provides a fluent interface for building a node.

Methods

__construct()

No description

$this
setParent(ParentNodeDefinitionInterface $parent = null)

Set the parent node.

arrayNode(string $name)

Creates a child array node.

scalarNode(string $name)

Creates a child scalar node.

booleanNode(string $name)

Creates a child Boolean node.

integerNode(string $name)

Creates a child integer node.

floatNode(string $name)

Creates a child float node.

enumNode(string $name)

Creates a child EnumNode.

variableNode(string $name)

Creates a child variable node.

end()

Returns the parent node.

node(string $name, string $type)

Creates a child node.

$this
append(NodeDefinition $node)

Appends a node definition.

$this
setNodeClass(string $type, string $class)

Adds or overrides a node Type.

Details

at line line 24
__construct()

at line line 42
$this setParent(ParentNodeDefinitionInterface $parent = null)

Set the parent node.

Parameters

ParentNodeDefinitionInterface $parent

Return Value

$this

at line line 56
ArrayNodeDefinition arrayNode(string $name)

Creates a child array node.

Parameters

string $name The name of the node

Return Value

ArrayNodeDefinition The child node

at line line 68
ScalarNodeDefinition scalarNode(string $name)

Creates a child scalar node.

Parameters

string $name The name of the node

Return Value

ScalarNodeDefinition The child node

at line line 80
BooleanNodeDefinition booleanNode(string $name)

Creates a child Boolean node.

Parameters

string $name The name of the node

Return Value

BooleanNodeDefinition The child node

at line line 92
IntegerNodeDefinition integerNode(string $name)

Creates a child integer node.

Parameters

string $name The name of the node

Return Value

IntegerNodeDefinition The child node

at line line 104
FloatNodeDefinition floatNode(string $name)

Creates a child float node.

Parameters

string $name The name of the node

Return Value

FloatNodeDefinition The child node

at line line 116
EnumNodeDefinition enumNode(string $name)

Creates a child EnumNode.

Parameters

string $name

Return Value

EnumNodeDefinition

at line line 128
VariableNodeDefinition variableNode(string $name)

Creates a child variable node.

Parameters

string $name The name of the node

Return Value

VariableNodeDefinition The builder of the child node

at line line 138
ParentNodeDefinitionInterface|NodeDefinition end()

Returns the parent node.

Return Value

ParentNodeDefinitionInterface|NodeDefinition The parent node

at line line 154
NodeDefinition node(string $name, string $type)

Creates a child node.

Parameters

string $name The name of the node
string $type The type of the node

Return Value

NodeDefinition The child node

Exceptions

RuntimeException When the node type is not registered
RuntimeException When the node class is not found

at line line 180
$this append(NodeDefinition $node)

Appends a node definition.

Usage:

$node = new ArrayNodeDefinition('name')
    ->children()
        ->scalarNode('foo')->end()
        ->scalarNode('baz')->end()
        ->append($this->getBarNodeDefinition())
    ->end()
;

Parameters

NodeDefinition $node

Return Value

$this

at line line 205
$this setNodeClass(string $type, string $class)

Adds or overrides a node Type.

Parameters

string $type The name of the type
string $class The fully qualified name the node definition class

Return Value

$this