/**
  * Loads definition from specific point of aspect into the container
  *
  * @param AspectContainer $container Instance of container
  * @param Aspect $aspect Instance of aspect
  * @param mixed|\ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflection Reflection of point
  * @param mixed|null $metaInformation Additional meta-information, e.g. annotation for method
  *
  * @throws \UnexpectedValueException
  */
 public function load(AspectContainer $container, Aspect $aspect, $reflection, $metaInformation = null)
 {
     $pointcut = $this->parsePointcut($aspect, $reflection, $metaInformation);
     $methodId = get_class($aspect) . '->' . $reflection->name;
     $adviceCallback = Framework\BaseAdvice::fromAspectReflection($aspect, $reflection);
     if (isset($metaInformation->scope) && $metaInformation->scope !== 'aspect') {
         $scope = $metaInformation->scope;
         $adviceCallback = Framework\BaseAdvice::createScopeCallback($aspect, $adviceCallback, $scope);
     }
     switch (true) {
         // Register a pointcut by its name
         case $metaInformation instanceof Annotation\Pointcut:
             $container->registerPointcut($pointcut, $methodId);
             break;
         case $pointcut instanceof PointFilter:
             $advice = $this->getInterceptor($metaInformation, $adviceCallback);
             if ($pointcut->getKind() & PointFilter::KIND_DYNAMIC) {
                 $advice = new Framework\DynamicInvocationMatcherInterceptor($pointcut, $advice);
             }
             $container->registerAdvisor(new DefaultPointcutAdvisor($pointcut, $advice), $methodId);
             break;
         default:
             throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
     }
 }
Ejemplo n.º 2
0
 /**
  * Configure an AspectContainer with advisors, aspects and pointcuts
  *
  * @param AspectContainer|Container $container
  *
  * @return void
  */
 protected final function configureAop(AspectContainer $container)
 {
     $aspectIds = $container->getParameter('aspect.list');
     foreach ($aspectIds as $aspectId) {
         $container->registerAspect($container->get($aspectId));
     }
 }
Ejemplo n.º 3
0
 /**
  * Configures an AspectContainer with advisors, aspects and pointcuts
  *
  * @param AspectContainer $container
  *
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $reader = $container->get('aspect.annotation.reader');
     $container->registerAspect(new InvariantCheckerAspect($reader));
     $container->registerAspect(new PostconditionCheckerAspect($reader));
     $container->registerAspect(new PreconditionCheckerAspect($reader));
 }
Ejemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 protected function configureAop(AspectContainer $container)
 {
     $typeCheckers = [new IntegerTypeChecker(), new CallableTypeChecker(), new StringTypeChecker(), new GenericObjectTypeChecker(), new ObjectTypeChecker(), new MixedTypeChecker(), new NullTypeChecker()];
     $typeCheckers[] = new TypedTraversableChecker(...$typeCheckers);
     $container->registerAspect(new PropertyWriteAspect(new PropertyWriteImmutabilityChecker(), new PropertyWriteTypeChecker()));
     $container->registerAspect(new PostConstructAspect(new ObjectStateChecker(new ApplyTypeChecks(...$typeCheckers), new PropertyTypeFinder())));
     $container->registerAspect(new PrePublicMethodAspect(new ParameterInterfaceJailer(new JailFactory())));
 }
Ejemplo n.º 5
0
 /**
  * Configure an AspectContainer with advisors, aspects and pointcuts
  *
  * @param \Go\Core\AspectContainer $container AOP Container instance
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     foreach ((array) aspects() as $class) {
         $class = class_exists($class) ? new $class() : null;
         if ($class instanceof Aspect) {
             $container->registerAspect($class);
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Registers all aspects from magento configuration in the aspect kernel.
  *
  * @param AspectContainer $container
  * @return void
  */
 public function configureAop(AspectContainer $container)
 {
     foreach ($this->_getAspects() as $class) {
         if ($class) {
             $aspect = new $class();
             $container->registerAspect($aspect);
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * Registers all aspects from magento configuration in the aspect kernel.
  *
  * @param AspectContainer $container
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $config = (array) Mage::getConfig()->getNode(self::CONFIG_PATH_AOP_ASPECTS);
     foreach ($config as $class) {
         if ($class) {
             $aspect = new $class();
             $container->registerAspect($aspect);
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Configure an AspectContainer with advisors, aspects and pointcuts
  *
  * @param AspectContainer $container
  *
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $container->registerAspect(new DeclareErrorAspect());
     $container->registerAspect(new CachingAspect());
     $container->registerAspect(new LoggingAspect());
     $container->registerAspect(new IntroductionAspect());
     $container->registerAspect(new PropertyInterceptorAspect());
     $container->registerAspect(new FunctionInterceptorAspect());
     $container->registerAspect(new FluentInterfaceAspect());
     $container->registerAspect(new HealthyLiveAspect());
     $container->registerAspect(new DynamicMethodsAspect());
 }
Ejemplo n.º 9
0
 /**
  * Constructs an wrapper for the composer loader
  *
  * @param ClassLoader $original Instance of current loader
  * @param AspectContainer $container Instance of the container
  * @param array $options Configuration options
  */
 public function __construct(ClassLoader $original, AspectContainer $container, array $options = [])
 {
     $this->options = $options;
     $this->original = $original;
     $prefixes = $original->getPrefixes();
     $excludePaths = $options['excludePaths'];
     // Let's exclude core dependencies from that list
     $excludePaths[] = $prefixes['Dissect'][0];
     $excludePaths[] = substr($prefixes['Doctrine\\Common\\Annotations\\'][0], 0, -16);
     $fileEnumerator = new Enumerator($options['appDir'], $options['includePaths'], $excludePaths);
     $this->fileEnumerator = $fileEnumerator;
     $this->cacheState = $container->get('aspect.cache.path.manager')->queryCacheState();
 }
Ejemplo n.º 10
0
 /**
  * Get the Pointcut that drives this advisor.
  *
  * @return Pointcut The pointcut
  */
 public function getPointcut()
 {
     if (!$this->pointcut) {
         // Inject this dependencies and make them lazy!
         // should be extracted from AbstractAspectLoaderExtension into separate class
         /** @var Pointcut\PointcutLexer $lexer */
         $lexer = $this->container->get('aspect.pointcut.lexer');
         /** @var Pointcut\PointcutParser $parser */
         $parser = $this->container->get('aspect.pointcut.parser');
         $tokenStream = $lexer->lex($this->pointcutExpression);
         $this->pointcut = $parser->parse($tokenStream);
     }
     return $this->pointcut;
 }
Ejemplo n.º 11
0
 /**
  * Returns a real pointcut from the container
  *
  * @return Pointcut
  */
 public function getPointcut()
 {
     if (!$this->pointcut) {
         $this->pointcut = $this->container->getPointcut($this->pointcutName);
     }
     return $this->pointcut;
 }
Ejemplo n.º 12
0
 /**
  * Return list of advices for class
  *
  * @param string|ReflectionClass|ParsedReflectionClass $class Class to advise
  *
  * @return array|Aop\Advice[] List of advices for class
  */
 public function getAdvicesForClass($class)
 {
     $this->loader->loadAdvisorsAndPointcuts();
     $classAdvices = array();
     if (!$class instanceof ReflectionClass && !$class instanceof ParsedReflectionClass) {
         $class = new ReflectionClass($class);
     }
     $parentClass = $class->getParentClass();
     if ($parentClass && preg_match('/' . AspectContainer::AOP_PROXIED_SUFFIX . '$/', $parentClass->name)) {
         $originalClass = $parentClass;
     } else {
         $originalClass = $class;
     }
     foreach ($this->container->getByTag('advisor') as $advisorId => $advisor) {
         if ($advisor instanceof Aop\PointcutAdvisor) {
             $pointcut = $advisor->getPointcut();
             if ($pointcut->getClassFilter()->matches($class)) {
                 $classAdvices = array_merge_recursive($classAdvices, $this->getAdvicesFromAdvisor($originalClass, $advisor, $advisorId, $pointcut));
             }
         }
         if ($advisor instanceof Aop\IntroductionAdvisor) {
             if ($advisor->getClassFilter()->matches($class)) {
                 $classAdvices = array_merge_recursive($classAdvices, $this->getIntroductionFromAdvisor($originalClass, $advisor, $advisorId));
             }
         }
     }
     return $classAdvices;
 }
Ejemplo n.º 13
0
 /**
  * Magic accessor
  *
  * @param string $name Key name
  *
  * @throws \InvalidArgumentException if referenced value is not an advisor
  * @return Advice
  */
 public function __get($name)
 {
     if ($this->container->has($name)) {
         $advisor = $this->container->get($name);
     } else {
         list(, $advisorName) = explode('.', $name);
         list($aspect) = explode('->', $advisorName);
         $aspectInstance = $this->container->getAspect($aspect);
         $this->loader->loadAndRegister($aspectInstance);
         $advisor = $this->container->get($name);
     }
     if (!$advisor instanceof Advisor) {
         throw new \InvalidArgumentException("Reference {$name} is not an advisor");
     }
     $this->{$name} = $advisor->getAdvice();
     return $this->{$name};
 }
Ejemplo n.º 14
0
 /**
  * Intercepts access to autowired properties and injects specified dependency
  *
  * @Around("@access(Warlock\Annotation\Autowired)")
  *
  * @param FieldAccess $joinpoint Autowiring joinpoint
  *
  * @return mixed
  */
 public function beforeAccessingAutowiredProperty(FieldAccess $joinpoint)
 {
     $obj = $joinpoint->getThis();
     $field = $joinpoint->getField();
     if ($joinpoint->getAccessType() == FieldAccess::READ) {
         /** @var Autowired $autowired */
         $autowired = $this->reader->getPropertyAnnotation($field, self::ANNOTATION_NAME);
         $strategy = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
         if (!$autowired->required) {
             $strategy = ContainerInterface::NULL_ON_INVALID_REFERENCE;
         }
         $value = $this->container->get($autowired, $strategy);
     } else {
         $value = $joinpoint->proceed();
     }
     $field->setValue($obj, $value);
     return $value;
 }
Ejemplo n.º 15
0
 /**
  * Check that list of advices for fields works correctly
  */
 public function testGetSinglePropertyAdviceForClassFromAdvisor()
 {
     $propName = 'container';
     // $this->container;
     $pointcut = $this->getMock('Go\\Aop\\Pointcut');
     $pointcut->expects($this->any())->method('getClassFilter')->will($this->returnValue(TruePointFilter::getInstance()));
     $pointcut->expects($this->any())->method('matches')->will($this->returnCallback(function ($point) use($propName) {
         return $point->name === $propName;
     }));
     $pointcut->expects($this->any())->method('getKind')->will($this->returnValue(Pointcut::KIND_PROPERTY));
     $advice = $this->getMock('Go\\Aop\\Advice');
     $advisor = new DefaultPointcutAdvisor($pointcut, $advice);
     $this->container->registerAdvisor($advisor, 'test');
     $advices = $this->adviceMatcher->getAdvicesForClass(__CLASS__);
     $this->assertArrayHasKey(AspectContainer::PROPERTY_PREFIX, $advices);
     $this->assertArrayHasKey($propName, $advices[AspectContainer::PROPERTY_PREFIX]);
     $this->assertCount(1, $advices[AspectContainer::PROPERTY_PREFIX]);
 }
Ejemplo n.º 16
0
 /**
  * Returns list of unloaded aspects in the container
  *
  * @return array|Aspect[]
  */
 public function getUnloadedAspects()
 {
     $unloadedAspects = [];
     foreach ($this->container->getByTag('aspect') as $aspect) {
         if (!isset($this->loadedAspects[get_class($aspect)])) {
             $unloadedAspects[] = $aspect;
         }
     }
     return $unloadedAspects;
 }
 /**
  * Loads definition from specific point of aspect into the container
  *
  * @param AspectContainer $container Instance of container
  * @param Aspect $aspect Instance of aspect
  * @param mixed|\ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflection Reflection of point
  * @param mixed|null $metaInformation Additional meta-information
  *
  * @throws \UnexpectedValueException
  */
 public function load(AspectContainer $container, Aspect $aspect, $reflection, $metaInformation = null)
 {
     $pointcut = $this->parsePointcut($aspect, $reflection, $metaInformation);
     $propertyId = $reflection->class . '->' . $reflection->name;
     switch (true) {
         case $metaInformation instanceof Annotation\DeclareParents:
             $interface = $metaInformation->interface;
             $implement = $metaInformation->defaultImpl;
             $advice = new Framework\TraitIntroductionInfo($interface, $implement);
             $advisor = new Support\DeclareParentsAdvisor($pointcut->getClassFilter(), $advice);
             $container->registerAdvisor($advisor, $propertyId);
             break;
         case $metaInformation instanceof Annotation\DeclareError:
             $reflection->setAccessible(true);
             $message = $reflection->getValue($aspect);
             $level = $metaInformation->level;
             $advice = new Framework\DeclareErrorInterceptor($message, $level);
             $container->registerAdvisor(new Support\DefaultPointcutAdvisor($pointcut, $advice), $propertyId);
             break;
         default:
             throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
     }
 }
Ejemplo n.º 18
0
 /**
  * Load pointcuts into container
  *
  * There is no need to always load pointcuts, so we delay loading
  */
 public function loadAdvisorsAndPointcuts()
 {
     $containerResources = $this->container->getResources();
     $resourcesToLoad = array_diff($containerResources, $this->loadedResources);
     if (!$resourcesToLoad) {
         return;
     }
     foreach ($this->container->getByTag('aspect') as $aspect) {
         $ref = new ReflectionClass($aspect);
         if (in_array($ref->getFileName(), $resourcesToLoad)) {
             $this->load($aspect);
         }
     }
     $this->loadedResources = $containerResources;
 }
Ejemplo n.º 19
0
 /**
  * Configure an AspectContainer with advisors, aspects and pointcuts
  *
  * @param AspectContainer $container
  *
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $container->registerAspect(new AuthorizationSecurityAspect());
 }
Ejemplo n.º 20
0
 /**
  * Add resources for kernel
  *
  * @param AspectContainer $container
  */
 protected function addKernelResourcesToContainer(AspectContainer $container)
 {
     $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
     $refClass = new \ReflectionObject($this);
     $container->addResource($trace[1]['file']);
     $container->addResource($refClass->getFileName());
 }
Ejemplo n.º 21
0
 /**
  * Configure an AspectContainer with advisors, aspect and pointcuts
  *
  * @param AspectContainer $container
  *
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $container->registerAspect(new DemoAspect('ASPECT!'));
 }
Ejemplo n.º 22
0
 /**
  * Declares the error message for specific pointcut expression
  *
  * @param string $pointcutExpression Pointcut, e.g. "within(**)"
  * @param string $message Error message to show
  * @param integer $level Error level to trigger
  */
 public function declareError($pointcutExpression, $message, $level = E_USER_ERROR)
 {
     $advice = new DeclareErrorInterceptor($message, $level);
     $this->container->registerAdvisor(new LazyPointcutAdvisor($this->container, $pointcutExpression, $advice), $this->getPointcutId($pointcutExpression));
 }
Ejemplo n.º 23
0
 /**
  * Collects list of advisors from the container
  *
  * @param AspectContainer $aspectContainer Container instance
  *
  * @return Advisor[] List of advisors in the container
  */
 private function loadAdvisorsList(AspectContainer $aspectContainer)
 {
     /** @var AspectLoader $aspectLoader */
     $aspectLoader = $aspectContainer->get('aspect.cached.loader');
     $aspects = $aspectLoader->getUnloadedAspects();
     foreach ($aspects as $aspect) {
         $aspectLoader->loadAndRegister($aspect);
     }
     $advisors = $aspectContainer->getByTag('advisor');
     return $advisors;
 }
Ejemplo n.º 24
0
 /**
  * Constructs a pointcut grammar with AST
  *
  * @param AspectContainer $container Instance of the container
  * @param RawAnnotationReader $annotationReader
  */
 public function __construct(AspectContainer $container = null, RawAnnotationReader $annotationReader = null)
 {
     $this('empty')->is();
     $this('pointcut')->is('pointcut', '||', 'pointcut')->call(function ($first, $_0, $second) {
         return new OrPointcut($first, $second);
     })->is('pointcut', '&&', 'pointcut')->call(function ($first, $_0, $second) {
         return new AndPointcut($first, $second);
     })->is('(', 'pointcut', ')')->call(function ($_0, $pointcut) {
         return $pointcut;
     })->is('!', 'pointcut')->call(function ($_0, $first) {
         return new NotPointcut($first);
     })->is('cflowbelow', '(', 'pointcut', ')')->call(function ($_0, $_1, $pointcut) {
         return new CFlowBelowMethodPointcut($pointcut);
     })->is('singlePointcut');
     $this('singlePointcut')->is('execution', '(', 'memberModifiers', 'classFilter', 'methodCall', 'namePattern', '(', '*', ')', ')')->call(function ($_0, $_1, ModifierMatcherFilter $memberModifiers, PointFilter $classFilter, $methodCallType, $methodNamePattern) {
         if ($methodCallType === '::') {
             $memberModifiers->andMatch(\ReflectionMethod::IS_STATIC);
         } else {
             $memberModifiers->notMatch(\ReflectionMethod::IS_STATIC);
         }
         $filterKind = PointFilter::KIND_METHOD;
         $pointcut = new SignaturePointcut($filterKind, $methodNamePattern, $memberModifiers);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('dynamic', '(', 'memberModifiers', 'classFilter', 'methodCall', 'namePattern', '(', '*', ')', ')')->call(function ($_0, $_1, ModifierMatcherFilter $memberModifiers, PointFilter $classFilter, $methodCallType, $methodNamePattern) {
         if ($methodCallType === '::') {
             $memberModifiers->andMatch(\ReflectionMethod::IS_STATIC);
         } else {
             $memberModifiers->notMatch(\ReflectionMethod::IS_STATIC);
         }
         $pointcut = new MagicMethodPointcut($methodNamePattern, $memberModifiers);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('execution', '(', 'namespacePattern', '(', '*', ')', ')')->call(function ($_0, $_1, $namespacePattern) {
         $lastNsPos = strrpos($namespacePattern, '\\');
         $namespace = substr($namespacePattern, 0, $lastNsPos);
         $funcPattern = substr($namespacePattern, $lastNsPos + 1);
         $nsFilter = new SimpleNamespaceFilter($namespace);
         $pointcut = new FunctionPointcut($funcPattern);
         $pointcut->setNamespaceFilter($nsFilter);
         return $pointcut;
     })->is('access', '(', 'memberModifiers', 'classFilter', '->', 'namePattern', ')')->call(function ($_0, $_1, ModifierMatcherFilter $memberModifiers, PointFilter $classFilter, $_2, $propertyNamePattern) {
         $filterKind = PointFilter::KIND_PROPERTY;
         $pointcut = new SignaturePointcut($filterKind, $propertyNamePattern, $memberModifiers);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('within', '(', 'classFilter', ')')->call(function ($_0, $_1, $classFilter) {
         $pointcut = new TruePointcut(PointFilter::KIND_ALL);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('annotation', 'access', '(', 'namespacePattern', ')')->call(function ($_0, $_1, $_2, $annotationClassName) use($annotationReader) {
         $kindProperty = PointFilter::KIND_PROPERTY;
         return new AnnotationPointcut($kindProperty, $annotationReader, $annotationClassName);
     })->is('annotation', 'execution', '(', 'namespacePattern', ')')->call(function ($_0, $_1, $_2, $annotationClassName) use($annotationReader) {
         $kindMethod = PointFilter::KIND_METHOD;
         return new AnnotationPointcut($kindMethod, $annotationReader, $annotationClassName);
     })->is('annotation', 'within', '(', 'namespacePattern', ')')->call(function ($_0, $_1, $_2, $annotationClassName) use($annotationReader) {
         $pointcut = new TruePointcut(PointFilter::KIND_ALL);
         $kindClass = PointFilter::KIND_CLASS;
         $classFilter = new AnnotationPointcut($kindClass, $annotationReader, $annotationClassName);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('initialization', '(', 'classFilter', ')')->call(function ($_0, $_1, $classFilter) {
         $pointcut = new TruePointcut(PointFilter::KIND_INIT + PointFilter::KIND_CLASS);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('staticinitialization', '(', 'classFilter', ')')->call(function ($_0, $_1, $classFilter) {
         $pointcut = new TruePointcut(PointFilter::KIND_STATIC_INIT + PointFilter::KIND_CLASS);
         $pointcut->setClassFilter($classFilter);
         return $pointcut;
     })->is('pointcutReference')->call(function ($pointcutName) use($container) {
         return $container->getPointcut($pointcutName);
     });
     $stringConverter = $this->getNodeToStringConverter();
     $this('pointcutReference')->is('namespacePattern', 'methodCall', 'namePart')->call($stringConverter);
     // stable
     $this('methodCall')->is('::')->call($stringConverter)->is('->')->call($stringConverter);
     $this('classFilter')->is('namespacePattern')->call(function ($pattern) {
         $filterKind = PointFilter::KIND_CLASS;
         $truePointFilter = TruePointFilter::getInstance();
         return $pattern === '**' ? $truePointFilter : new SignaturePointcut($filterKind, $pattern, $truePointFilter);
     })->is('namespacePattern', '+')->call(function ($parentClassName) {
         return new InheritanceClassFilter($parentClassName);
     });
     // stable
     $this('namespacePattern')->is('namePattern')->is('**')->call($stringConverter)->is('namespacePattern', 'nsSeparator', 'namespacePattern')->call($stringConverter);
     // stable
     $this('namePattern')->is('namePattern', '*')->call($stringConverter)->is('namePattern', 'namePart')->call($stringConverter)->is('namePattern', '|', 'namePart')->call($stringConverter)->is('namePart')->call($stringConverter)->is('*')->call($stringConverter);
     // stable
     $this('memberModifiers')->is('*')->call(function () {
         $matcher = new ModifierMatcherFilter();
         return $matcher->orMatch(-1);
     })->is('nonEmptyMemberModifiers');
     // stable
     $this('nonEmptyMemberModifiers')->is('memberModifier')->call(function ($modifier) {
         return new ModifierMatcherFilter($modifier);
     })->is('nonEmptyMemberModifiers', '|', 'memberModifier')->call(function (ModifierMatcherFilter $matcher, $_0, $modifier) {
         return $matcher->orMatch($modifier);
     })->is('nonEmptyMemberModifiers', 'memberModifier')->call(function (ModifierMatcherFilter $matcher, $modifier) {
         return $matcher->andMatch($modifier);
     });
     // stable
     $converter = $this->getModifierConverter();
     $this('memberModifier')->is('public')->call($converter)->is('protected')->call($converter)->is('private')->call($converter)->is('final')->call($converter);
     $this->resolve(Grammar::ALL);
     $this->start('pointcut');
 }
Ejemplo n.º 25
0
 public function registerBundleAspect(\Go\Core\AspectContainer $appAspectContainer)
 {
     $appAspectContainer->registerAspect(new \examples\exampleBundle\Aspect\AccessAspect());
 }
Ejemplo n.º 26
0
 /**
  * Configures an AspectContainer with advisors, aspects and pointcuts
  *
  * @param AspectContainer $container
  *
  * @return void
  */
 protected function configureAop(AspectContainer $container)
 {
     $reader = $container->get('aspect.annotation.reader');
     $container->registerAspect(new ContractCheckerAspect($reader));
 }
 protected function configureAop(AspectContainer $container)
 {
     $container->registerAspect(new MonitorAspect());
 }
Ejemplo n.º 28
0
 /**
  * General method to register advices
  *
  * @param string $pointcutExpression Pointcut expression string
  * @param Advice $advice Instance of advice
  */
 private function registerAdviceInContainer($pointcutExpression, Advice $advice)
 {
     $this->container->registerAdvisor(new LazyPointcutAdvisor($this->container, $pointcutExpression, $advice), $this->getPointcutId($pointcutExpression));
 }