Element builder
From Sunhill Framework Documentation
The ElementBuilder class is a helper for adding elements to a record property.
__construct(RecordProperty $owner)
Takes the owning record property as a parameter for later use.
Adding a property
addProperty(string $property_name, string $name): AbstractProperty
Decides how $property_name is resolved:
- When it is a namespaced class name it is used as such
- When it is a string it is used as a property name and looked up via the Properties facade.
Using the property name as a method
It's also possible to use the property name as a method. This method accepts excactly one string Parameter and that is the property name.
Example
$builder->integer("int_element");
Creates an element of type integer, names it "int_element" and returns it.