How to add method to the class if the override class cannot be?

different services of the application returns objects of different types

$searchResults
$someOtherResults
$arrayOfValueObjects

if it is not possible to override them, as to do so they could "lead to a common denominator"

foreach(array_merge($searchResults, $someOtherResults, $arrayOfValueObjects) as $item) {
$item->render();
}
July 5th 19 at 00:07
1 answer
July 5th 19 at 00:09
to wrap up the work with these services to another service which actually will act as a facade to hide all the dirt that you do what would be convenient.
And if you write a class which implement Traversable. And when you try loopинга will return the element which has the render method - erna_Bergstr commented on July 5th 19 at 00:12

Find more questions by tags Designing softwareOOPPHPSymfony