protected function loadFrom(Aspect $aspect, Reflector $reflector, array $loaders): array
    {
        $loadedItems = [];

        foreach ($loaders as $loader) {
            $loaderKind = $loader->getKind();
            switch ($loaderKind) {
                case AspectLoaderExtension::KIND_REFLECTION:
                    if ($loader->supports($aspect, $reflector)) {
                        $loadedItems += $loader->load($aspect, $reflector);
                    }
                    break;

                case AspectLoaderExtension::KIND_ANNOTATION:
                    $annotations = $this->getAnnotations($reflector);
                    foreach ($annotations as $annotation) {
                        if ($loader->supports($aspect, $reflector, $annotation)) {
                            $loadedItems += $loader->load($aspect, $reflector, $annotation);
                        }
                    }
                    break;

                default:
                    throw new InvalidArgumentException("Unsupported loader kind {$loaderKind}");
            }
        }

        return $loadedItems;
    }
protected function loadFrom(Aspect $aspect, Reflector $reflector, array $loaders): array
    {
        $loadedItems = [];

        foreach ($loaders as $loader) {
            $loaderKind = $loader->getKind();
            switch ($loaderKind) {
                case AspectLoaderExtension::KIND_REFLECTION:
                    if ($loader->supports($aspect, $reflector)) {
                        $loadedItems += $loader->load($aspect, $reflector);
                    }
                    break;

                case AspectLoaderExtension::KIND_ANNOTATION:
                    $annotations = $this->getAnnotations($reflector);
                    foreach ($annotations as $annotation) {
                        if ($loader->supports($aspect, $reflector, $annotation)) {
                            $loadedItems += $loader->load($aspect, $reflector, $annotation);
                        }
                    }
                    break;

                default:
                    throw new InvalidArgumentException("Unsupported loader kind {$loaderKind}");
            }
        }

        return $loadedItems;
    }
protected function loadFrom ( Aspect $ aspect , Reflector $ reflector , array $ loaders ) : array { $ loadedItems = [ ] ; foreach ( $ loaders as $ loader ) { $ loaderKind = $ loader -> getKind ( ) ; switch ( $ loaderKind ) { case AspectLoaderExtension :: KIND_REFLECTION : if ( $ loader -> supports ( $ aspect , $ reflector ) ) { $ loadedItems += $ loader -> load ( $ aspect , $ reflector ) ; } break ; case AspectLoaderExtension :: KIND_ANNOTATION : $ annotations = $ this -> getAnnotations ( $ reflector ) ; foreach ( $ annotations as $ annotation ) { if ( $ loader -> supports ( $ aspect , $ reflector , $ annotation ) ) { $ loadedItems += $ loader -> load ( $ aspect , $ reflector , $ annotation ) ; } } break ; default : throw new InvalidArgumentException ( "Unsupported loader kind {$loaderKind}" ) ; } } return $ loadedItems ; }
Load definitions from specific aspect part into the aspect container

@param Aspect $aspect Aspect instance
@param Reflector $reflector Reflection instance
@param array|AspectLoaderExtension[] $loaders List of loaders that can produce advisors from aspect class

@throws \InvalidArgumentException If kind of loader isn't supported

@return array|Pointcut[]|Advisor[]
Load definitions from specific aspect part into the aspect container