public function create(string $resourceClass, string $name, array $options = []) : PropertyMetadata
{
if (null === $this->decorated) {
$propertyMetadata = new PropertyMetadata();
} else {
try {
$propertyMetadata = $this->decorated->create($resourceClass, $name, $options);
} catch (PropertyNotFoundException $propertyNotFoundException) {
$propertyMetadata = new PropertyMetadata();
}
}
if (null === $propertyMetadata->getType()) {
$types = $this->propertyInfo->getTypes($resourceClass, $name, $options);
if (isset($types[0])) {
$propertyMetadata = $propertyMetadata->withType($types[0]);
}
}
if (null === $propertyMetadata->getDescription() && null !== ($description = $this->propertyInfo->getShortDescription($resourceClass, $name, $options))) {
$propertyMetadata = $propertyMetadata->withDescription($description);
}
if (null === $propertyMetadata->isReadable() && null !== ($readable = $this->propertyInfo->isReadable($resourceClass, $name, $options))) {
$propertyMetadata = $propertyMetadata->withReadable($readable);
}
if (null === $propertyMetadata->isWritable() && null !== ($writable = $this->propertyInfo->isWritable($resourceClass, $name, $options))) {
$propertyMetadata = $propertyMetadata->withWritable($writable);
}
return $propertyMetadata;
}