Go\Core\GeneralAspectLoaderExtension::load PHP Method

load() public method

Loads definition from specific point of aspect into the container
public load ( Go\Aop\Aspect $aspect, mixed | ReflectionClass | ReflectionMethod | ReflectionProperty $reflection, mixed | null $metaInformation = null ) : array | Go\Aop\Pointcut[] | Go\Aop\Advisor[]
$aspect Go\Aop\Aspect Instance of aspect
$reflection mixed | ReflectionClass | ReflectionMethod | ReflectionProperty Reflection of point
$metaInformation mixed | null Additional meta-information, e.g. annotation for method
return array | Go\Aop\Pointcut[] | Go\Aop\Advisor[]
    public function load(Aspect $aspect, $reflection, $metaInformation = null)
    {
        $loadedItems = [];
        $pointcut = $this->parsePointcut($aspect, $reflection, $metaInformation);
        $methodId = get_class($aspect) . '->' . $reflection->name;
        $adviceCallback = $reflection->getClosure($aspect);
        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;
    }