src/Hydra/Serializer/DocumentationNormalizer.php
private function getRange(PropertyMetadata $propertyMetadata): ?string
    {
        $jsonldContext = $propertyMetadata->getAttributes()['jsonld_context'] ?? [];

        if (isset($jsonldContext['@type'])) {
            return $jsonldContext['@type'];
        }

        if (null === $type = $propertyMetadata->getType()) {
            return null;
        }

        if ($type->isCollection() && null !== $collectionType = $type->getCollectionValueType()) {
            $type = $collectionType;
        }

        switch ($type->getBuiltinType()) {
            case Type::BUILTIN_TYPE_STRING:
                return 'xmls:string';
            case Type::BUILTIN_TYPE_INT:
                return 'xmls:integer';
            case Type::BUILTIN_TYPE_FLOAT:
                return 'xmls:decimal';
            case Type::BUILTIN_TYPE_BOOL:
                return 'xmls:boolean';
            case Type::BUILTIN_TYPE_OBJECT:
                if (null === $className = $type->getClassName()) {
                    return null;
                }

                if (is_a($className, \DateTimeInterface::class, true)) {
                    return 'xmls:dateTime';
                }

                if ($this->resourceClassResolver->isResourceClass($className)) {
                    $resourceMetadata = $this->resourceMetadataFactory->create($className);

                    return $resourceMetadata->getIri() ?? "#{$resourceMetadata->getShortName()}";
                }
                break;
        }

        return null;
    }
private function getRange(PropertyMetadata $propertyMetadata): ?string
    {
        $jsonldContext = $propertyMetadata->getAttributes()['jsonld_context'] ?? [];

        if (isset($jsonldContext['@type'])) {
            return $jsonldContext['@type'];
        }

        if (null === $type = $propertyMetadata->getType()) {
            return null;
        }

        if ($type->isCollection() && null !== $collectionType = $type->getCollectionValueType()) {
            $type = $collectionType;
        }

        switch ($type->getBuiltinType()) {
            case Type::BUILTIN_TYPE_STRING:
                return 'xmls:string';
            case Type::BUILTIN_TYPE_INT:
                return 'xmls:integer';
            case Type::BUILTIN_TYPE_FLOAT:
                return 'xmls:decimal';
            case Type::BUILTIN_TYPE_BOOL:
                return 'xmls:boolean';
            case Type::BUILTIN_TYPE_OBJECT:
                if (null === $className = $type->getClassName()) {
                    return null;
                }

                if (is_a($className, \DateTimeInterface::class, true)) {
                    return 'xmls:dateTime';
                }

                if ($this->resourceClassResolver->isResourceClass($className)) {
                    $resourceMetadata = $this->resourceMetadataFactory->create($className);

                    return $resourceMetadata->getIri() ?? "#{$resourceMetadata->getShortName()}";
                }
                break;
        }

        return null;
    }
private function getRange ( PropertyMetadata $ propertyMetadata ) : ? string { $ jsonldContext = $ propertyMetadata -> getAttributes ( ) [ 'jsonld_context' ] ?? [ ] ; if ( isset ( $ jsonldContext [ '@type' ] ) ) { return $ jsonldContext [ '@type' ] ; } if ( null === $ type = $ propertyMetadata -> getType ( ) ) { return null ; } if ( $ type -> isCollection ( ) && null !== $ collectionType = $ type -> getCollectionValueType ( ) ) { $ type = $ collectionType ; } switch ( $ type -> getBuiltinType ( ) ) { case Type :: BUILTIN_TYPE_STRING : return 'xmls:string' ; case Type :: BUILTIN_TYPE_INT : return 'xmls:integer' ; case Type :: BUILTIN_TYPE_FLOAT : return 'xmls:decimal' ; case Type :: BUILTIN_TYPE_BOOL : return 'xmls:boolean' ; case Type :: BUILTIN_TYPE_OBJECT : if ( null === $ className = $ type -> getClassName ( ) ) { return null ; } if ( is_a ( $ className , \ DateTimeInterface :: class , true ) ) { return 'xmls:dateTime' ; } if ( $ this -> resourceClassResolver -> isResourceClass ( $ className ) ) { $ resourceMetadata = $ this -> resourceMetadataFactory -> create ( $ className ) ; return $ resourceMetadata -> getIri ( ) ?? "#{$resourceMetadata->getShortName()}" ; } break ; } return null ; }
Gets the range of the property.
Gets the range of the property .