/**
  * 
  * @param ClassAnnotationHolder $annotations
  * @return array
  */
 protected function handleClassAnnotations(ClassAnnotationHolder $annotations, array $config = array())
 {
     $events = new EventManager();
     $this->listener->attach($events);
     $event = new ParseEvent(ParseEvent::EVENT_CLASS_PARSED, $annotations, ['config' => $config, 'scannedConfig' => array()]);
     $events->triggerEvent($event);
     $finalizeEvent = new ParseEvent(ParseEvent::EVENT_FINALIZE, $event->getResult(), ['config' => $config]);
     $events->triggerEvent($finalizeEvent);
     return $finalizeEvent->getTarget();
 }
 /**
  * {@inheritDoc}
  */
 public function detach(EventManagerInterface $events)
 {
     $sharedEvents = $events->getSharedManager();
     foreach ($this->listeners as $index => $callback) {
         if ($sharedEvents->detach(static::SHARED_EVENT_ID, $callback)) {
             unset($this->listeners[$index]);
         }
     }
     parent::detach($events);
 }
 /**
  * 
  * @param ClassAnnotationHolder $annotations
  * @return array
  */
 protected function handleClassAnnotations(ClassAnnotationHolder $annotations, array $config = array())
 {
     $event = new ParseEvent(ParseEvent::EVENT_CLASS_PARSED, $annotations, ['config' => $config]);
     $this->listener->onClassParsed($event);
     return $event->getResult();
 }