Getting end users to grasp the concept of data structures is no easy task. While the concept of objects having properties (for instance, a customer having a first name and a last name) is usually easy to convey, you probably would not bother end users with things like data encapsulation and object methods.
Because of this, it might be useful to hide the intricacies of data access from your end user; if a user want to access a customer's first name, they should be able to write customer.firstname
, even if the actual property of the underlying object is protected, and you would usually need to call a getFirstname()
method to read this property. Since getter functions typically follow certain naming patterns, our parser can automatically translate expressions such as customer.firstname
to method calls such as $customer->getFirstname()
.
To implement this feature, we need to extend the evaluate
method of PropertyFetch
by a few special cases:
public function evaluate(array...