Generate an options array for an attribute.

@param \ProAI\Datamapper\Annotations\Annotation $annotation
@return array
962149
protected function generateAttributeOptionsArray(Annotation $annotation)
    {
        $options = [];

        // length option
        if ($annotation->type == 'string' || $annotation->type == 'char' || $annotation->type == 'binary') {
            $options['length'] = $annotation->length;
        }

        // fixed option
        if ($annotation->type == 'binary' && $annotation->length == 16) {
            $options['fixed'] = $annotation->fixed;
            $options['autoUuid'] = $annotation->autoUuid;
        }

        // unsigned and autoIncrement option
        if ($annotation->type == 'smallInteger' || $annotation->type == 'integer' || $annotation->type == 'bigInteger') {
            $options['unsigned'] = $annotation->unsigned;
            $options['autoIncrement'] = $annotation->autoIncrement;
        }

        // scale and precision option
        if ($annotation->type == 'decimal') {
            $options['scale'] = $annotation->scale;
            $options['precision'] = $annotation->precision;
        }

        return $options;
    }
846538
private function source(Annotation $annotation): string
    {
        if ($annotation->hasValueByName('source')) {
            return ucfirst(strtolower($annotation->getSource()));
        }

        return 'Param';
    }
444611
private function filterAnnotations(array $annotations): array
    {
        $annotations = \array_filter($annotations, function ($annotation) {
            $ref = new \ReflectionObject($annotation);

            return 0 === \mb_strpos($ref->getNamespaceName(), 'TSantos\Serializer');
        });

        return $annotations;
    }
562828
public static function getPropertyAnnotations($className, $propertyName, $annotationClassName = null)
    {
        if(!isset(static::$annotations[$className]['Properties'][$propertyName]))
        {
            return [];
        }
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Properties'][$propertyName];
        }
        else
        {
            $result = [];
            foreach(static::$annotations[$className]['Properties'][$propertyName] as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[] = $annotation;
                }
            }
            return $result;
        }
    }
639368
public function loadAnnotations($annotations)
    {
        $moreSettings = parse_ini_string($annotations, true) ?: [];

        if (@$guardedFields = $moreSettings['blacklist']) {
            $this->setBlacklist(explode(',', $guardedFields));
        } // if

        if (@$moreSettings['casting'] && is_array($moreSettings['casting'])) {
            $this->setCastedFields($moreSettings['casting']);
        } // if

        if (@$modelName = $moreSettings['model']) {
            $this->setModelName($modelName);
        } // if

        $this->isPivotTable(@ (bool)$moreSettings['isPivot']);
        $this->withoutTimestamps(@ (bool)$moreSettings['withoutTimestamps']);

        return !@$moreSettings['ignore'];
    }
332783
private function getLabels($annotations)
    {
        $it = $this->getAnnotations()->filter($annotations)
            ->is(Label::class)
            ->onProperties();
        $labels = [];
        foreach ($it as $annotation) {
            $labels[$annotation->getPropertyName()] = $annotation->value;
        }
        return $labels;
    }
144112
public function having($annotation)
    {
        $methods = [];

        foreach ($this->reflectInto($this->reference) as $method) {
            if ($this->hasAnnotation($annotation, $method)) {
                $methods[] = $method->getName();
            }
        }

        // We'll reverse the results to ensure that this package's
        // hooks are called *before* the user's.

        return array_reverse($methods);
    }
368565
public static function parseDays(string $annotation)
	{
		static $validValues = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun',];

		$days = NULL;
		$annotation = Strings::trim($annotation);
		if (Strings::length($annotation)) {
			$days = static::translateToDayNames($annotation);
			$days = static::expandDaysRange($days);
			foreach ($days as $day) {
				if (!in_array($day, $validValues)) {
					throw new InvalidParameterException(
						"Given day parameter '" . $day . "' must be one from " . implode(', ', $validValues) . "."
					);
				}
			}
			$days = array_values(array_intersect($validValues, $days));
		}

		return $days ?: NULL;
	}
189503
protected function filterContractAnnotation(array $annotations): array
    {
        $contractAnnotations = [];

        foreach ($annotations as $annotation) {
            $annotationClass = \get_class($annotation);

            if (\in_array($annotationClass, $this->expectedAnnotationTypes, true)) {
                $contractAnnotations[] = $annotation;
            }
        }

        return $contractAnnotations;
    }
454048
protected function tryToGetJoinColumnNameOfMappedBy($annotation){
        $annotation = $this->tryToGetJoinColumnAnnotationOfMappedBy($annotation);
        if ($annotation !== null) {
            if ($annotation instanceof JoinColumn) {
                return $annotation->name;
            } else if ($annotation instanceof JoinColumns) {
                if (count($annotation->value) > 1) {
                    throw new \Exception('Multiple foreign key is not supported');
                }
                return $annotation->value[0]->name;
            }
        }
        return '';
    }
391894
public static function add_annotation(annotation $annotation) {
        global $DB;

        $annotation->id = null;
        return $DB->insert_record('assignfeedback_editpdf_annot', $annotation);
    }
713036
public function getConverterOptions($converter, $attribute)
    {
        $lcAttr = strtolower($attribute);

        $options = [];
        if (isset($this->converterOptions[$converter]) && isset($this->converterOptions[$converter][$lcAttr])) {
            $options = $this->converterOptions[$converter][$lcAttr];
        }

        return $options;
    }
375867
public static function getPropertiesAnnotations($className, $annotationClassName = null)
    {
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Properties'] ?? [];
        }
        $result = [];
        foreach(static::$annotations[$className]['Properties'] ?? [] as $propertyName => $annotations)
        {
            foreach($annotations as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[$propertyName][] = $annotation;
                }
            }
        }
        return $result;
    }
634993
private function processOptionAnnotation(\JPC\MongoDB\ODM\Annotations\Mapping\Option $annotation)
    {
        $options = [];
        if (isset($annotation->writeConcern)) {
            $options["writeConcern"] = $annotation->writeConcern->getWriteConcern();
        }

        if (isset($annotation->readConcern)) {
            $options["readConcern"] = $annotation->readConcern->getReadConcern();
        }

        if (isset($annotation->readPreference)) {
            $options["readPreference"] = $annotation->readPreference->getReadPreference();
        }

        if (isset($annotation->typeMap)) {
            $options["typeMap"] = $annotation->typeMap;
        }

        $this->collectionInfo->setOptions($options);
    }
320940
protected function createValidatorInstanceFromAnnotation($validatorAnnotation)
    {
        return ValidatorBuilder::builder()
            ->withSpecification($validatorAnnotation->getValue())
            ->withClass($validatorAnnotation->getAssociatedClass())
            ->build();
    }
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;
    }
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;
    }