This class describe an action taken by the AOP framework at a particular joinpoint. Different types of advice include "around", "before" and "after" advices. Around advice is an advice that surrounds a joinpoint such as a method invocation. This is the most powerful kind of advice. Around advices will perform custom behavior before and after the method invocation. They are responsible for choosing whether to proceed to the joinpoint or to shortcut executing by returning their own return value or throwing an exception. After and before advices are simple closures that will be invoked after and before main invocation. Framework model an advice as an PHP-closure interceptor, maintaining a chain of interceptors "around" the joinpoint: function (Joinpoint $joinPoint) { echo 'Before action'; call chain here with Joinpoint->proceed() method $result = $joinPoint->proceed(); echo 'After action'; return $result; }
Inheritance: implements Go\Aop\Framework\OrderedAdvice
 /**
  * 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));
     }
 }
 /**
  * Loads definition from specific point of aspect into the 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
  *
  * @return array|Pointcut[]|Advisor[]
  *
  * @throws \UnexpectedValueException
  */
 public function load(Aspect $aspect, $reflection, $metaInformation = null)
 {
     $loadedItems = array();
     $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:
             $loadedItems[$methodId] = $pointcut;
             break;
         case $pointcut instanceof PointFilter:
             $advice = $this->getInterceptor($metaInformation, $adviceCallback);
             $loadedItems[$methodId] = new DefaultPointcutAdvisor($pointcut, $advice);
             break;
         default:
             throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
     }
     return $loadedItems;
 }