class AddNewProperty extends AbstractTransformation (View source)

Add the new property and its value

Properties

protected string $newPropertyName
protected string $value

Methods

bool
isTransformable(NodeData $node)

If the given node has no property this transformation should work on, this returns true.

execute(NodeData $node)

Add the new property with the given value on the given node.

void
setNewPropertyName(string $newPropertyName)

Sets the name of the new property to be added.

void
setValue(string $value)

Property value to be set.

Details

bool isTransformable(NodeData $node)

If the given node has no property this transformation should work on, this returns true.

Parameters

NodeData $node

Return Value

bool

NodeData execute(NodeData $node)

Add the new property with the given value on the given node.

Parameters

NodeData $node

Return Value

NodeData

void setNewPropertyName(string $newPropertyName)

Sets the name of the new property to be added.

Parameters

string $newPropertyName

Return Value

void

void setValue(string $value)

Property value to be set.

Parameters

string $value

Return Value

void