예제 #1
0
파일: Xml.php 프로젝트: sakshika/ATM
 public function handle(AbstractEvent $event)
 {
     if ($event instanceof ClassStartEvent) {
         $ctx = $event->getClass();
         $path = 'classes';
     } else {
         if ($event instanceof TraitStartEvent) {
             $ctx = $event->getTrait();
             $path = 'traits';
         } else {
             if ($event instanceof InterfaceStartEvent) {
                 $ctx = $event->getInterface();
                 $path = 'interfaces';
             }
         }
     }
     $dom = $ctx->asDom();
     $this->saveDomDocument($dom, $this->outputDir . '/' . $path . '/' . str_replace('\\', '_', $dom->documentElement->getAttribute('full')) . '.xml');
 }
예제 #2
0
파일: Xml.php 프로젝트: theseer/phpdox
 public function handle(AbstractEvent $event)
 {
     if ($event instanceof ClassStartEvent) {
         $ctx = $event->getClass();
         $path = 'classes';
     } else {
         if ($event instanceof TraitStartEvent) {
             $ctx = $event->getTrait();
             $path = 'traits';
         } else {
             if ($event instanceof InterfaceStartEvent) {
                 $ctx = $event->getInterface();
                 $path = 'interfaces';
             } else {
                 throw new EngineException('Unexpected Event of type ' . get_class($event), XMLEngineException::UnexpectedType);
             }
         }
     }
     $dom = $ctx->asDom();
     $this->saveDomDocument($dom, $this->outputDir . '/' . $path . '/' . str_replace('\\', '_', $dom->documentElement->getAttribute('full')) . '.xml');
 }
예제 #3
0
 /**
  * @param AbstractEvent $event
  * @param bool          $progress
  */
 private function handleEvent(AbstractEvent $event, $progress = TRUE)
 {
     $eventType = $event->getType();
     if (isset($this->enrichers[$eventType])) {
         foreach ($this->enrichers[$eventType] as $enricher) {
             switch ($eventType) {
                 case 'phpdox.start':
                     $enricher->enrichStart($event);
                     break;
                 case 'class.start':
                     $enricher->enrichClass($event);
                     break;
                 case 'interface.start':
                     $enricher->enrichInterface($event);
                     break;
                 case 'trait.start':
                     $enricher->enrichTrait($event);
                     break;
                 case 'token.file.start':
                     $enricher->enrichTokenFile($event);
                     break;
                 case 'phpdox.end':
                     $enricher->enrichEnd($event);
                     break;
             }
         }
     }
     foreach ($this->handlerRegistry->getHandlersForEvent($event->getType()) as $callback) {
         call_user_func($callback, $event);
     }
     if ($progress) {
         $this->logger->progress('processed');
     }
 }