getAttributes() public method

Gets attributes.
public getAttributes ( ) : array | null
return array | null
 public function testValueObject()
 {
     $type = new Type(Type::BUILTIN_TYPE_STRING);
     $metadata = new PropertyMetadata(new Type(Type::BUILTIN_TYPE_STRING), 'desc', true, true, false, false, true, false, 'http://example.com/foo', null, ['foo' => 'bar']);
     $this->assertEquals($type, $metadata->getType());
     $this->assertEquals('desc', $metadata->getDescription());
     $this->assertTrue($metadata->isReadable());
     $this->assertTrue($metadata->isWritable());
     $this->assertFalse($metadata->isReadableLink());
     $this->assertFalse($metadata->isWritableLink());
     $this->assertTrue($metadata->isRequired());
     $this->assertFalse($metadata->isIdentifier());
     $this->assertEquals('http://example.com/foo', $metadata->getIri());
     $this->assertEquals(['foo' => 'bar'], $metadata->getAttributes());
     $newType = new Type(Type::BUILTIN_TYPE_BOOL);
     $newMetadata = $metadata->withType($newType);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertEquals($newType, $newMetadata->getType());
     $newMetadata = $metadata->withDescription('description');
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertEquals('description', $newMetadata->getDescription());
     $newMetadata = $metadata->withReadable(false);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertFalse($newMetadata->isReadable());
     $newMetadata = $metadata->withWritable(false);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertFalse($newMetadata->isWritable());
     $newMetadata = $metadata->withReadableLink(true);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertTrue($newMetadata->isReadableLink());
     $newMetadata = $metadata->withWritableLink(true);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertTrue($newMetadata->isWritableLink());
     $newMetadata = $metadata->withRequired(false);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertFalse($newMetadata->isRequired());
     $newMetadata = $metadata->withIdentifier(true);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertTrue($newMetadata->isIdentifier());
     $newMetadata = $metadata->withIri('foo:bar');
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertEquals('foo:bar', $newMetadata->getIri());
     $newMetadata = $metadata->withAttributes(['a' => 'b']);
     $this->assertNotSame($metadata, $newMetadata);
     $this->assertEquals(['a' => 'b'], $newMetadata->getAttributes());
 }
 /**
  * Gets the range of the property.
  *
  * @param PropertyMetadata $propertyMetadata
  *
  * @return string|null
  */
 private function getRange(PropertyMetadata $propertyMetadata)
 {
     $jsonldContext = $propertyMetadata->getAttributes()['jsonld_context'] ?? [];
     if (isset($jsonldContext['@type'])) {
         return $jsonldContext['@type'];
     }
     if (null === ($type = $propertyMetadata->getType())) {
         return;
     }
     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:number';
         case Type::BUILTIN_TYPE_BOOL:
             return 'xmls:boolean';
         case Type::BUILTIN_TYPE_OBJECT:
             if (null === ($className = $type->getClassName())) {
                 return;
             }
             if (is_a($className, \DateTimeInterface::class, true)) {
                 return 'xmls:dateTime';
             }
             if ($this->resourceClassResolver->isResourceClass($className)) {
                 return sprintf('#%s', $this->resourceMetadataFactory->create($className)->getShortName());
             }
             break;
     }
 }