src/Annotation/Annotations.php
private function create($annotation, $context)
    {
        $logger = $this->getLogger();
        $name = $annotation['name'];
        if (!$this->isValidName($name)) {
            return null;
        }
        $annotationClass = $this->resolveClassName($name, $context['declaringClass']);
        if (!$annotationClass) {
            if (isset($this->imports[$name])) {
                $annotationClass = $this->imports[$name];
            } else {
                $logger->warning("Unknown annotation '$name' at {$annotation['file']}:{$annotation['line']}");
                return null;
            }
        }
        if (!class_exists($annotationClass)) {
            $logger->warning("Annotation class '$annotationClass' does not exist"
                             ." at {$annotation['file']}:{$annotation['line']}");
            return null;
        }
        if (!is_subclass_of($annotationClass, Annotation::class)) {
            $logger->warning("Annotation class '$annotationClass' at {$annotation['file']}:{$annotation['line']}"
                             ." is not subclass of " . Annotation::class);
            return null;
        }
        $context['file'] = $annotation['file'];
        $context['line'] = $annotation['line'];
        $args = (new PhalconAnnotation($annotation))->getArguments() ?: [];
        return new $annotationClass($args, new Context($context));
    }
private function create($annotation, $context)
    {
        $logger = $this->getLogger();
        $name = $annotation['name'];
        if (!$this->isValidName($name)) {
            return null;
        }
        $annotationClass = $this->resolveClassName($name, $context['declaringClass']);
        if (!$annotationClass) {
            if (isset($this->imports[$name])) {
                $annotationClass = $this->imports[$name];
            } else {
                $logger->warning("Unknown annotation '$name' at {$annotation['file']}:{$annotation['line']}");
                return null;
            }
        }
        if (!class_exists($annotationClass)) {
            $logger->warning("Annotation class '$annotationClass' does not exist"
                             ." at {$annotation['file']}:{$annotation['line']}");
            return null;
        }
        if (!is_subclass_of($annotationClass, Annotation::class)) {
            $logger->warning("Annotation class '$annotationClass' at {$annotation['file']}:{$annotation['line']}"
                             ." is not subclass of " . Annotation::class);
            return null;
        }
        $context['file'] = $annotation['file'];
        $context['line'] = $annotation['line'];
        $args = (new PhalconAnnotation($annotation))->getArguments() ?: [];
        return new $annotationClass($args, new Context($context));
    }
private function create ( $ annotation , $ context ) { $ logger = $ this -> getLogger ( ) ; $ name = $ annotation [ 'name' ] ; if ( ! $ this -> isValidName ( $ name ) ) { return null ; } $ annotationClass = $ this -> resolveClassName ( $ name , $ context [ 'declaringClass' ] ) ; if ( ! $ annotationClass ) { if ( isset ( $ this -> imports [ $ name ] ) ) { $ annotationClass = $ this -> imports [ $ name ] ; } else { $ logger -> warning ( "Unknown annotation '$name' at {$annotation['file']}:{$annotation['line']}" ) ; return null ; } } if ( ! class_exists ( $ annotationClass ) ) { $ logger -> warning ( "Annotation class '$annotationClass' does not exist" . " at {$annotation['file']}:{$annotation['line']}" ) ; return null ; } if ( ! is_subclass_of ( $ annotationClass , Annotation :: class ) ) { $ logger -> warning ( "Annotation class '$annotationClass' at {$annotation['file']}:{$annotation['line']}" . " is not subclass of " . Annotation :: class ) ; return null ; } $ context [ 'file' ] = $ annotation [ 'file' ] ; $ context [ 'line' ] = $ annotation [ 'line' ] ; $ args = ( new PhalconAnnotation ( $ annotation ) ) -> getArguments ( ) ? : [ ] ; return new $ annotationClass ( $ args , new Context ( $ context ) ) ; }
create annotation object
create annotation object