class RenameProperty extends AbstractTransformation (View source)

Rename a given property.

Properties

protected string $oldPropertyName

Property name to change

protected string $newPropertyName

New name of property

Methods

bool
isTransformable(NodeData $node)

Returns true if the given node has a property with the name to work on and does not yet have a property with the name to rename that property to.

execute(NodeData $node)

Renames the configured property to the new name.

void
setFrom(string $oldPropertyName)

Sets the name of the property to change.

void
setTo(string $newPropertyName)

Sets the new name for the property to change.

Details

bool isTransformable(NodeData $node)

Returns true if the given node has a property with the name to work on and does not yet have a property with the name to rename that property to.

Parameters

NodeData $node

Return Value

bool

NodeData execute(NodeData $node)

Renames the configured property to the new name.

Parameters

NodeData $node

Return Value

NodeData

void setFrom(string $oldPropertyName)

Sets the name of the property to change.

Parameters

string $oldPropertyName

Return Value

void

void setTo(string $newPropertyName)

Sets the new name for the property to change.

Parameters

string $newPropertyName

Return Value

void