public function visit(OrganizationEntry $entry) { if ($entry instanceof \DoYouPhp\PhpDesignPattern\Visitor\ConcreteElement\Group) { $this->group_count++; } else { $this->employee_count++; } foreach ($entry->getChildren() as $ent) { $this->visit($ent); } }
public function visit(OrganizationEntry $entry) { if ($entry instanceof \DoYouPhp\PhpDesignPattern\Visitor\ConcreteElement\Group) { echo '■'; } else { echo '-->'; } echo $entry->getCode() . ":" . $entry->getName() . PHP_EOL; foreach ($entry->getChildren() as $child) { $child->accept($this); } }