Go\Core\IntroductionAspectExtension::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
return array | Go\Aop\Pointcut[] | Go\Aop\Advisor[]
    public function load(Aspect $aspect, $reflection, $metaInformation = null)
    {
        $loadedItems = [];
        $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);
                $loadedItems[$propertyId] = $advisor;
                break;
            case $metaInformation instanceof Annotation\DeclareError:
                $reflection->setAccessible(true);
                $message = $reflection->getValue($aspect);
                $level = $metaInformation->level;
                $advice = new Framework\DeclareErrorInterceptor($message, $level, $metaInformation->value);
                $loadedItems[$propertyId] = new Support\DefaultPointcutAdvisor($pointcut, $advice);
                break;
            default:
                throw new \UnexpectedValueException("Unsupported pointcut class: " . get_class($pointcut));
        }
        return $loadedItems;
    }
IntroductionAspectExtension