protected function getInterceptor(BaseInterceptor $metaInformation, Closure $adviceCallback): Interceptor
    {
        $adviceOrder        = $metaInformation->order;
        $pointcutExpression = $metaInformation->value;
        switch (true) {
            case ($metaInformation instanceof Annotation\Before):
                return new Framework\BeforeInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\After):
                return new Framework\AfterInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\Around):
                return new Framework\AroundInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\AfterThrowing):
                return new Framework\AfterThrowingInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            default:
                throw new UnexpectedValueException('Unsupported method meta class: ' . get_class($metaInformation));
        }
    }
protected function getInterceptor(BaseInterceptor $metaInformation, Closure $adviceCallback): Interceptor
    {
        $adviceOrder        = $metaInformation->order;
        $pointcutExpression = $metaInformation->value;
        switch (true) {
            case ($metaInformation instanceof Annotation\Before):
                return new Framework\BeforeInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\After):
                return new Framework\AfterInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\Around):
                return new Framework\AroundInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            case ($metaInformation instanceof Annotation\AfterThrowing):
                return new Framework\AfterThrowingInterceptor($adviceCallback, $adviceOrder, $pointcutExpression);

            default:
                throw new UnexpectedValueException('Unsupported method meta class: ' . get_class($metaInformation));
        }
    }
protected function getInterceptor ( BaseInterceptor $ metaInformation , Closure $ adviceCallback ) : Interceptor { $ adviceOrder = $ metaInformation -> order ; $ pointcutExpression = $ metaInformation -> value ; switch ( true ) { case ( $ metaInformation instanceof Annotation \ Before ) : return new Framework \ BeforeInterceptor ( $ adviceCallback , $ adviceOrder , $ pointcutExpression ) ; case ( $ metaInformation instanceof Annotation \ After ) : return new Framework \ AfterInterceptor ( $ adviceCallback , $ adviceOrder , $ pointcutExpression ) ; case ( $ metaInformation instanceof Annotation \ Around ) : return new Framework \ AroundInterceptor ( $ adviceCallback , $ adviceOrder , $ pointcutExpression ) ; case ( $ metaInformation instanceof Annotation \ AfterThrowing ) : return new Framework \ AfterThrowingInterceptor ( $ adviceCallback , $ adviceOrder , $ pointcutExpression ) ; default : throw new UnexpectedValueException ( 'Unsupported method meta class: ' . get_class ( $ metaInformation ) ) ; } }
Returns an interceptor instance by meta-type annotation and closure

@throws UnexpectedValueException For unsupported annotations
Returns an interceptor instance by meta - type annotation and closure