Core/Engine/Engine.php
protected function _callAnnotation(Controller &$class, $annotation = [], $type = 'class', $annotationType = 'Before') {
        foreach ($annotation[$type] as $action => $annotationClasses) {
            foreach ($annotationClasses as $annotationClass) {
                if ($annotationClass['annotation'] == $annotationType) {
                    /** @var \Gcs\Framework\Core\Annotation\Annotations\Common\Before $instance */
                    $instance = $annotationClass['instance'];

                    $className = $instance->class;
                    $methodName = $instance->method;

                    if (method_exists($className, $methodName)) {
                        if ($className == get_class($class)) {
                            $class->$methodName();
                        }
                        else {
                            $reflectionMethod = new \ReflectionMethod($className, $methodName);
                            echo $reflectionMethod->invoke(new $className());
                        }
                    }
                    else {
                        throw new MissingMethodException('The method "' . $methodName . '" from the class "' . $className . '" does not exist');
                    }
                }
            }
        }
    }
protected function _callAnnotation(Controller &$class, $annotation = [], $type = 'class', $annotationType = 'Before') {
        foreach ($annotation[$type] as $action => $annotationClasses) {
            foreach ($annotationClasses as $annotationClass) {
                if ($annotationClass['annotation'] == $annotationType) {
                    /** @var \Gcs\Framework\Core\Annotation\Annotations\Common\Before $instance */
                    $instance = $annotationClass['instance'];

                    $className = $instance->class;
                    $methodName = $instance->method;

                    if (method_exists($className, $methodName)) {
                        if ($className == get_class($class)) {
                            $class->$methodName();
                        }
                        else {
                            $reflectionMethod = new \ReflectionMethod($className, $methodName);
                            echo $reflectionMethod->invoke(new $className());
                        }
                    }
                    else {
                        throw new MissingMethodException('The method "' . $methodName . '" from the class "' . $className . '" does not exist');
                    }
                }
            }
        }
    }
protected function _callAnnotation ( Controller & $ class , $ annotation = [ ] , $ type = 'class' , $ annotationType = 'Before' ) { foreach ( $ annotation [ $ type ] as $ action => $ annotationClasses ) { foreach ( $ annotationClasses as $ annotationClass ) { if ( $ annotationClass [ 'annotation' ] == $ annotationType ) { /** @var \Gcs\Framework\Core\Annotation\Annotations\Common\Before $instance */ $ instance = $ annotationClass [ 'instance' ] ; $ className = $ instance -> class ; $ methodName = $ instance -> method ; if ( method_exists ( $ className , $ methodName ) ) { if ( $ className == get_class ( $ class ) ) { $ class -> $ methodName ( ) ; } else { $ reflectionMethod = new \ ReflectionMethod ( $ className , $ methodName ) ; echo $ reflectionMethod -> invoke ( new $ className ( ) ) ; } } else { throw new MissingMethodException ( 'The method "' . $ methodName . '" from the class "' . $ className . '" does not exist' ) ; } } } } }
call all annotation methods required
@param Controller $class
@param array $annotation
@param string $type
@param string $annotationType
@throws MissingMethodException
@access  protected
@since   3.0
@package Gcs\Framework\Core\Engine
call all annotation methods required