Exemple #1
0
 /**
  * Looks for any global aspects that may apply to this bean and applies them.
  *
  * @param BeanDefinition $definition
  * @param IDispatcher $dispatcher
  *
  * @return void
  */
 private function _applyGlobalAspects(BeanDefinition $definition, IDispatcher $dispatcher)
 {
     $class = $definition->getClass();
     $rClass = $this->_reflectionFactory->getClass($class);
     foreach ($this->_aspectManager->getAspects() as $aspect) {
         $expression = $aspect->getExpression();
         if (preg_match('/' . $expression . '/', $class) === 0) {
             $parentClass = $rClass->getParentClass();
             while ($parentClass !== false) {
                 if (preg_match('/' . $expression . '/', $parentClass->getName()) > 0) {
                     $this->_applyAspect($class, $aspect, $dispatcher);
                 }
                 $parentClass = $parentClass->getParentClass();
             }
         } else {
             $this->_applyAspect($class, $aspect, $dispatcher);
         }
     }
 }