private function _applyAspect(
        $targetClass, AspectDefinition $aspectDefinition, IDispatcher $dispatcher
    ) {
        $rClass = $this->_reflectionFactory->getClass($targetClass);
        $aspect = $this->getBean($aspectDefinition->getBeanName());
        foreach ($aspectDefinition->getPointcuts() as $pointcutName) {
            $pointcut = $this->_aspectManager->getPointcut($pointcutName);
            if ($pointcut === false) {
                throw new BeanFactoryException('Could not find pointcut: ' . $pointcutName);
            }
            $expression = $pointcut->getExpression();
            foreach  ($rClass->getMethods() as $method) {
                $methodName = $method->getName();
                if (preg_match('/' . $expression . '/', $methodName) === 0) {
                    continue;
                }
                if (
                    $aspectDefinition->getType() == AspectDefinition::ASPECT_METHOD
                ) {
                    $dispatcher->addMethodInterceptor($methodName, $aspect, $pointcut->getMethod());
                } else {
                    $dispatcher->addExceptionInterceptor($methodName, $aspect, $pointcut->getMethod());
                }
            }
        }
    }
private function _applyAspect(
        $targetClass, AspectDefinition $aspectDefinition, IDispatcher $dispatcher
    ) {
        $rClass = $this->_reflectionFactory->getClass($targetClass);
        $aspect = $this->getBean($aspectDefinition->getBeanName());
        foreach ($aspectDefinition->getPointcuts() as $pointcutName) {
            $pointcut = $this->_aspectManager->getPointcut($pointcutName);
            if ($pointcut === false) {
                throw new BeanFactoryException('Could not find pointcut: ' . $pointcutName);
            }
            $expression = $pointcut->getExpression();
            foreach  ($rClass->getMethods() as $method) {
                $methodName = $method->getName();
                if (preg_match('/' . $expression . '/', $methodName) === 0) {
                    continue;
                }
                if (
                    $aspectDefinition->getType() == AspectDefinition::ASPECT_METHOD
                ) {
                    $dispatcher->addMethodInterceptor($methodName, $aspect, $pointcut->getMethod());
                } else {
                    $dispatcher->addExceptionInterceptor($methodName, $aspect, $pointcut->getMethod());
                }
            }
        }
    }
private function _applyAspect ( $ targetClass , AspectDefinition $ aspectDefinition , IDispatcher $ dispatcher ) { $ rClass = $ this -> _reflectionFactory -> getClass ( $ targetClass ) ; $ aspect = $ this -> getBean ( $ aspectDefinition -> getBeanName ( ) ) ; foreach ( $ aspectDefinition -> getPointcuts ( ) as $ pointcutName ) { $ pointcut = $ this -> _aspectManager -> getPointcut ( $ pointcutName ) ; if ( $ pointcut === false ) { throw new BeanFactoryException ( 'Could not find pointcut: ' . $ pointcutName ) ; } $ expression = $ pointcut -> getExpression ( ) ; foreach ( $ rClass -> getMethods ( ) as $ method ) { $ methodName = $ method -> getName ( ) ; if ( preg_match ( '/' . $ expression . '/' , $ methodName ) === 0 ) { continue ; } if ( $ aspectDefinition -> getType ( ) == AspectDefinition :: ASPECT_METHOD ) { $ dispatcher -> addMethodInterceptor ( $ methodName , $ aspect , $ pointcut -> getMethod ( ) ) ; } else { $ dispatcher -> addExceptionInterceptor ( $ methodName , $ aspect , $ pointcut -> getMethod ( ) ) ; } } } }
Will inject into the given dispatcher the necessary information to
aspects will be run correctly.

@throws BeanFactoryException
@return void
Will inject into the given dispatcher the necessary information to aspects will be run correctly .