Ding\Container\Impl\ContainerImpl::_applyGlobalAspects PHP Method

_applyGlobalAspects() private method

Looks for any global aspects that may apply to this bean and applies them.
private _applyGlobalAspects ( Ding\Bean\BeanDefinition $definition, Ding\Aspect\Interceptor\IDispatcher $dispatcher ) : void
$definition Ding\Bean\BeanDefinition
$dispatcher Ding\Aspect\Interceptor\IDispatcher
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);
            }
        }
    }