예제 #1
0
파일: CountVisitor.php 프로젝트: JJmaz/dp
 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);
     }
 }
예제 #2
0
파일: DumpVisitor.php 프로젝트: JJmaz/dp
 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);
     }
 }