ApiPlatform\Core\Metadata\Property\Factory\ExtractorPropertyNameCollectionFactory::create PHP Method

create() public method

public create ( string $resourceClass, array $options = [] ) : PropertyNameCollection
$resourceClass string
$options array
return ApiPlatform\Core\Metadata\Property\PropertyNameCollection
    public function create(string $resourceClass, array $options = []) : PropertyNameCollection
    {
        $propertyNames = [];
        if ($this->decorated) {
            try {
                foreach ($propertyNameCollection = $this->decorated->create($resourceClass, $options) as $propertyName) {
                    $propertyNames[$propertyName] = true;
                }
            } catch (ResourceClassNotFoundException $resourceClassNotFoundException) {
                // Ignore not found exceptions from parent
            }
        }
        if (!class_exists($resourceClass)) {
            if (isset($propertyNameCollection)) {
                return $propertyNameCollection;
            }
            throw new ResourceClassNotFoundException(sprintf('The resource class "%s" does not exist.', $resourceClass));
        }
        if ($properties = $this->extractor->getResources()[$resourceClass]['properties'] ?? false) {
            foreach ($properties as $propertyName => $property) {
                $propertyNames[$propertyName] = true;
            }
        }
        return new PropertyNameCollection(array_keys($propertyNames));
    }
ExtractorPropertyNameCollectionFactory