As it is currently, only the public properties of the Event are added to the webhook's payload.
What if we have private properties that are only exposed via getters and have setters that define how class properties should be altered? Not only is having properties public not a good practice, some events have special logic taking place which updates its properties in a given manner and thus they cannot be exposed. Otherwise, third party plugins capturing that event might corrupt the data and cause unexpected side-effects.
Would you consider adding, for instance, a check that determines if the Event implements \JsonSerializable and then use its ::jsonSerialize() instead of looking through exposed public properties? Or perhaps check for the presence of getter methods akin to symfony/property-access?
As it is currently, only the
public
properties of theEvent
are added to the webhook's payload.What if we have
private
properties that are only exposed via getters and have setters that define how class properties should be altered? Not only is having propertiespublic
not a good practice, some events have special logic taking place which updates its properties in a given manner and thus they cannot be exposed. Otherwise, third party plugins capturing that event might corrupt the data and cause unexpected side-effects.Would you consider adding, for instance, a check that determines if the
Event
implements\JsonSerializable
and then use its::jsonSerialize()
instead of looking through exposedpublic
properties? Or perhaps check for the presence of getter methods akin to symfony/property-access?