@param object[] $annotations

@return mixed[]
546144
private function loadAnnotations(array $annotations)
    {
        $definition = [];

        foreach ($annotations as $annotation) {
            if ($annotation instanceof Alias) {
                $definition['alias'] = $annotation->alias;
            } elseif ($annotation instanceof Type) {
                $definition['type'] = $annotation->type;
            } elseif ($annotation instanceof Expose) {
                $definition['expose'] = true;
            } elseif ($annotation instanceof Exclude) {
                $definition['exclude'] = true;
            } elseif ($annotation instanceof Readable) {
                $definition['readable'] = $annotation->readable;
            } elseif ($annotation instanceof Writable) {
                $definition['writable'] = $annotation->writable;
            } elseif ($annotation instanceof Accessor) {
                $definition['accessor'] = $annotation->accessor;
            } elseif ($annotation instanceof Mutator) {
                $definition['mutator'] = $annotation->mutator;
            } elseif ($annotation instanceof Since) {
                $definition['since'] = $annotation->version;
            } elseif ($annotation instanceof Until) {
                $definition['until'] = $annotation->version;
            } elseif ($annotation instanceof MaxDepth) {
                $definition['max_depth'] = $annotation->maxDepth;
            } elseif ($annotation instanceof Groups) {
                $definition['groups'] = $annotation->groups;
            } elseif ($annotation instanceof XmlAttribute) {
                $definition['xml_attribute'] = true;
            } elseif ($annotation instanceof XmlValue) {
                $definition['xml_value'] = true;
            } elseif ($annotation instanceof XmlCollection) {
                if ($annotation->entry !== null) {
                    $definition['xml_entry'] = $annotation->entry;
                }

                if ($annotation->entryAttribute !== null) {
                    $definition['xml_entry_attribute'] = $annotation->entryAttribute;
                }

                if ($annotation->keyAsAttribute !== null) {
                    $definition['xml_key_as_attribute'] = $annotation->keyAsAttribute;
                }

                if ($annotation->keyAsNode !== null) {
                    $definition['xml_key_as_node'] = $annotation->keyAsNode;
                }

                if ($annotation->inline !== null) {
                    $definition['xml_inline'] = $annotation->inline;
                }
            }
        }

        return $definition;
    }
983067
protected function getMappingClasses(): array
    {
        AnnotationRegistry::registerLoader('class_exists');

        $mappingClasses = [];

        foreach ($this->locator->getMappingFiles() as $annotationFile) {
            $mappingClasses[] = $this->loadClassFromFile($annotationFile);
        }

        return \array_map(
            function (string $sourceClass) {
                return new \ReflectionClass($sourceClass);
            },
            \array_filter(\array_unique($mappingClasses))
        );
    }
1136993
private function getOperationFormats(array $annotationFormats): array
    {
        $resourceFormats = [];
        foreach ($annotationFormats as $format => $value) {
            if (!is_numeric($format)) {
                $resourceFormats[$format] = (array) $value;
                continue;
            }
            if (!\is_string($value)) {
                throw new InvalidArgumentException(sprintf("The 'formats' attributes value must be a string when trying to include an already configured format, %s given.", \gettype($value)));
            }
            if (\array_key_exists($value, $this->configuredFormats)) {
                $resourceFormats[$value] = $this->configuredFormats[$value];
                continue;
            }

            throw new InvalidArgumentException(sprintf("You either need to add the format '%s' to your project configuration or declare a mime type for it in your annotation.", $value));
        }

        return $resourceFormats;
    }
902107
private function allowedValues(Annotation $annotation): array
    {
        if ($annotation->hasValueByName('allowed')) {
            return array_map('trim', explode('|', $annotation->getAllowed()));
        } elseif ($annotation->hasValueByName('allowedSource')) {
            return call_user_func(array_map('trim', explode(
                    '::',
                    str_replace('()', '', $annotation->getAllowedSource())
            )));
        }

        throw new \RuntimeException(
                'No list of allowed values in annotation @Request[OneOf] on '
                . $annotation->target()
        );
    }
1210253
public function getObjectPropertyAnnotations($document)
    {
        $cacheKey = "object_property_annotations_" . get_class($document);
        if (!$this->cache->contains($cacheKey)) {
            $refObject   = new \ReflectionObject($document);
            $annotations = array();
            foreach ($refObject->getProperties() as $property) {
                $annotation = $this->getPropertyAnnotation($property);
                if ($annotation) {
                    $annotations[$property->getName()] = $annotation;
                }
            }
            $this->cache->save($cacheKey, $annotations);
        }
        return $this->cache->fetch($cacheKey);
    }
646392
protected function detectCacheKeys(
        MethodInvocation $invocation,
        Annotation $annotation,
        array $keys
    ): array {
        $arguments = $invocation->getArguments();
        foreach ($invocation->getMethod()->getParameters() as $parameter) {
            // exclude object
            if (in_array('#' . $parameter->name, $annotation->key)) {
                if (isset($arguments[$parameter->getPosition()])) {
                    if (!is_object($arguments[$parameter->getPosition()])) {
                        $keys[] = $arguments[$parameter->getPosition()];
                    }
                }
                if (!isset($arguments[$parameter->getPosition()])) {
                    $keys[] = $parameter->getDefaultValue();
                }
            }
        }

        return $keys;
    }
1025189
private function resolveAnnotations($comment)
    {
        if (!$comment) {
            return [];
        }

        $comment = $this->cleanAnnotations($comment);
        $annotations = $this->splitAnnotations($comment);
        $annotations = $this->cleanContents($annotations);
        $annotations = $this->parseAnnotations($annotations);

        return $annotations;
    }
1033322
public function isParseMethodAnnotations(array $annotations): bool
    {
        $after = isset($annotations[After::class]) || isset($annotations[AfterThrowing::class]) || isset($annotations[AfterReturning::class]);

        return isset($annotations[Before::class]) || isset($annotations[Around::class]) || $after;
    }
1175740
private function scanFileListForAnnotations()
    {
        $annotations = [];
        foreach ($this->getFileList() as $file) {
            $this->classListByFiles[$file] = ClassInformationFromFile::getClassesFromFile($file)[0];
            $annotations[$this->classListByFiles[$file]] = $this->scanClassForAnnotations(
                $this->classListByFiles[$file]
            );
        }
        return $annotations;
    }
1161806
public function getAnnotations(){
        if($this->reader === null){
            return null;
        }

        if($this->annotations === null){
            $this->annotations  = [];

            foreach($this->reader->getAnnotations() as $annotation){
                $key    = "";
                $value  = "";

                if(($pos = mb_strpos($annotation, " ")) === false){
                    $key    = mb_substr($annotation, 1);
                }else{
                    $key    = mb_substr($annotation, 1, $pos - 1);
                    $value  = ltrim(mb_substr($annotation, $pos));
                }

                if(!array_key_exists($key, $this->annotations)){
                    $this->annotations[$key]    = [];
                }

                $this->annotations[$key][]  = $value;
            }
        }

        return $this->annotations;
    }
484864
protected function annotationToArray($annotation)
    {
        $options = array();
        foreach ((array) $annotation as $key => $value) {
            if ($value !== null) {
                $options[$key] = $value;
            }
        }

        return $options;
    }
1183379
public static function unserializeAnnotations($annotations)
    {
        $returnValue = array();

        
        $matches = array();
        $encoding = self::getApplicationHelper()->getDefaultEncoding();
        
        if (preg_match_all('/(#[\.\:,\|]{0,1}\s+(?:[^\\n]*))/', $annotations, $matches) !== false){
            if (isset($matches[1]) && count($matches[1]) > 0){
                foreach ($matches[1] as $match){
                    $match = trim($match);
                    $matchLen = mb_strlen($match, $encoding);
                    $annotationId = null;
                    $annotationValue = null;
                    
                    switch (mb_substr($match, 1, 1, $encoding)){
                        case "\t":
                        case ' ':
                            // Translator comment.
                            $annotationId = tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS;
                            $annotationValue = mb_substr($match, 2, $matchLen - 2, $encoding);
                        break;
                        
                        case '.':
                            $annotationId = tao_helpers_translation_POTranslationUnit::EXTRACTED_COMMENTS;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case ':':
                            $annotationId = tao_helpers_translation_POTranslationUnit::REFERENCE;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case ',':
                            $annotationId = tao_helpers_translation_POTranslationUnit::FLAGS;
                            $annotationValue = mb_substr($match, 3, $matchLen - 3, $encoding);
                        break;
                        
                        case '|':
                            if (($pos = mb_strpos($match, 'msgid_plural', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgid_plural', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID_PLURAL;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                            else if(($pos = mb_strpos($match, 'msgid', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgid', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                            else if(($pos = mb_strpos($match, 'msgctxt', 0, $encoding)) !== false){
                                $pos += mb_strlen('msgctxt', $encoding) + 1;
                                $annotationId = tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGCTXT;
                                $annotationValue = mb_substr($match, $pos, $matchLen - $pos, $encoding);
                            }
                        break;
                    }
                    
                    if ($annotationId != null && $annotationValue != null){
                        if (!isset($returnValue[$annotationId])){
                            $returnValue[$annotationId] = $annotationValue;
                        }
                        else{
                            $returnValue[$annotationId] .= "\n${annotationValue}";
                        }
                    }
                }
            }
            
        }
        else{
            throw new tao_helpers_translation_TranslationException("An error occured while unserializing annotations '${annotations}'.");
        }
        

        return (array) $returnValue;
    }
19424
private function processClassAnnotation($annotation)
    {
        $class = get_class($annotation);
        switch ($class) {
            case "JPC\MongoDB\ODM\Annotations\Mapping\Document":
                $this->collectionInfo->setCollection($annotation->collectionName);

                if (null !== ($rep = $annotation->repositoryClass)) {
                    $this->collectionInfo->setRepository($annotation->repositoryClass);
                } else {
                    if (class_exists($this->getName() . 'Repository')) {
                        $this->collectionInfo->setRepository($this->getName() . 'Repository');
                    } else {
                        $this->collectionInfo->setRepository("JPC\MongoDB\ODM\Repository");
                    }
                }

                if (null !== ($rep = $annotation->hydratorClass)) {
                    $this->collectionInfo->setHydrator($annotation->hydratorClass);
                } else {
                    $this->collectionInfo->setHydrator("JPC\MongoDB\ODM\Hydrator");
                }

                $this->checkCollectionCreationOptions($annotation);
                break;
            case "JPC\MongoDB\ODM\GridFS\Annotations\Mapping\Document":
                $this->collectionInfo->setBucketName($annotation->bucketName);
                $this->collectionInfo->setCollection($annotation->bucketName . ".files");

                if (null !== ($rep = $annotation->repositoryClass)) {
                    $this->collectionInfo->setRepository($annotation->repositoryClass);
                } else {
                    $this->collectionInfo->setRepository("JPC\MongoDB\ODM\GridFS\Repository");
                }

                if (null !== ($rep = $annotation->hydratorClass)) {
                    $this->collectionInfo->setHydrator($annotation->hydratorClass);
                } else {
                    $this->collectionInfo->setHydrator("JPC\MongoDB\ODM\GridFS\Hydrator");
                }
                break;
            case "JPC\MongoDB\ODM\Annotations\Mapping\Option":
                $this->processOptionAnnotation($annotation);
                break;
            case "JPC\MongoDB\ODM\Annotations\Event\HasLifecycleCallbacks":
                $this->hasEvent = true;
                break;
        }
    }
401115
public function getArray($annotation, $default = []) {
        $str = $this->getString($annotation);
        if (is_array($str)) {
            return $str;
        }
        if ($str) {
            $str = trim($str);
            $str = pure_comman_string($str);

            return explode(',', $str);
        }

        return $default;
    }
86953
public function processAnnotation(Route $annotation) : array
    {
        $parameterNames = [];

        $regexp = preg_replace_callback('/\{([^\}]+)\}|(.+?)/', function(array $matches) use ($annotation, & $parameterNames) : string {
            if (isset($matches[2])) {
                return preg_quote($matches[2], '/');
            }

            $parameterName = $matches[1];
            $parameterNames[] = $parameterName;

            if (isset($annotation->patterns[$parameterName])) {
                $pattern = $annotation->patterns[$parameterName];
            } else {
                $pattern = '[^\/]+';
            }

            return '(' . $pattern. ')';
        }, $annotation->path);

        foreach ($annotation->patterns as $parameterName => $pattern) {
            if (! in_array($parameterName, $parameterNames, true)) {
                throw new \LogicException(sprintf('Pattern does not match any parameter: "%s".', $parameterName));
            }
        }

        return [$regexp, $parameterNames];
    }
648014
public function parseClassAnnotations(string $className, array $annotations)
    {
        if (!$this->isParseClass($annotations)) {
            return null;
        }

        $beanData = null;
        foreach ($annotations as $annotation) {
            $annotationClass = get_class($annotation);
            if (!in_array($annotationClass, $this->getClassAnnotations())) {
                continue;
            }

            // annotation parser
            $annotationParser = $this->getAnnotationParser($annotation);
            if ($annotationParser == null) {
                continue;
            }
            $annotationData = $annotationParser->parser($className, $annotation);
            if ($annotationData != null) {
                $beanData = $annotationData;
            }
        }

        return $beanData;
    }
994142
public function get($entity, $annotation)
    {
        $properties = $this->getProperties($entity);

        $return = array();
        foreach ($properties as $reflectionProperty) {
            $propertyAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, $annotation);
            if (!is_null($propertyAnnotation) && get_class($propertyAnnotation) == $annotation) {
                $return[$reflectionProperty->name] = $reflectionProperty;
            }
        }

        return $return;
    }