You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is such a small function (and I didn't see any tests for getCustomProperty()) that I didn't want to go through the process of creating a PR, so I thought I'd offer it here. Hope you find it useful.
/** * Get the values of multiple custom properties with the given names. * @param array $propertyNames * @return array */publicfunctiongetCustomProperties(array$propertyNames): array
{
returnarray_intersect_key(
$this->custom_properties,
array_flip($propertyNames)
);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I found myself needing to retrieve several custom properties at the same time, and it just felt yucky to have so many calls to
getCustomProperty()
Instead of doing this
It just feels better to do this
This is such a small function (and I didn't see any tests for getCustomProperty()) that I didn't want to go through the process of creating a PR, so I thought I'd offer it here. Hope you find it useful.
returns
Edit: I guess you could also do this?
Beta Was this translation helpful? Give feedback.
All reactions