ApiPlatform\Core\Hydra\Serializer\DocumentationNormalizer::getPropertyNameCollectionFactoryContext PHP Method

getPropertyNameCollectionFactoryContext() private method

Gets the context for the property name factory.
private getPropertyNameCollectionFactoryContext ( ResourceMetadata $resourceMetadata ) : array
$resourceMetadata ApiPlatform\Core\Metadata\Resource\ResourceMetadata
return array
    private function getPropertyNameCollectionFactoryContext(ResourceMetadata $resourceMetadata) : array
    {
        $attributes = $resourceMetadata->getAttributes();
        $context = [];
        if (isset($attributes['normalization_context']['groups'])) {
            $context['serializer_groups'] = $attributes['normalization_context']['groups'];
        }
        if (isset($attributes['denormalization_context']['groups'])) {
            if (isset($context['serializer_groups'])) {
                $context['serializer_groups'] += $attributes['denormalization_context']['groups'];
            } else {
                $context['serializer_groups'] = $attributes['denormalization_context']['groups'];
            }
        }
        return $context;
    }