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); } }
public function __construct($code, $name) { parent::__construct($code, $name); $this->entries = array(); }
public function __construct($code, $name) { parent::__construct($code, $name); }