Use of getter methods instead of direct variables

I want to create a Stripe webhook, in some places I need to have some conditions like:
if ($event->object->data[0]->blah == “blah”) {…

Instead of these long conditions, isn’t it better to pass all event data to another class and just use getter methods like below?

if ($object->getBlah() == “blah”)
{
No disadvantage for performance? Or this is not recommended because of performance?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.