I have got a $branch object that can contain other $branch objects:
$branch->children();
Each of them can have $apples as children.
$branch->apples();
How can I collect all of the $apples from the $branch recursively?
function collectApples($branch){
$apples = array();
?
return $apples;
}