ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer::getPathOperation PHP Method

getPathOperation() private method

Gets a path Operation Object.
See also: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object
private getPathOperation ( string $operationName, array $operation, string $method, boolean $collection, string $resourceClass, ResourceMetadata $resourceMetadata, array $mimeTypes, ArrayObject $definitions ) : ArrayObject
$operationName string
$operation array
$method string
$collection boolean
$resourceClass string
$resourceMetadata ApiPlatform\Core\Metadata\Resource\ResourceMetadata
$mimeTypes array
$definitions ArrayObject
return ArrayObject
    private function getPathOperation(string $operationName, array $operation, string $method, bool $collection, string $resourceClass, ResourceMetadata $resourceMetadata, array $mimeTypes, \ArrayObject $definitions) : \ArrayObject
    {
        $pathOperation = new \ArrayObject($operation['swagger_context'] ?? []);
        $resourceShortName = $resourceMetadata->getShortName();
        $pathOperation['tags'] ?? ($pathOperation['tags'] = [$resourceShortName]);
        $pathOperation['operationId'] ?? ($pathOperation['operationId'] = lcfirst($operationName) . ucfirst($resourceShortName) . ucfirst($collection ? 'collection' : 'item'));
        switch ($method) {
            case 'GET':
                return $this->updateGetOperation($pathOperation, $mimeTypes, $collection, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions);
            case 'POST':
                return $this->updatePostOperation($pathOperation, $mimeTypes, $collection, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions);
            case 'PUT':
                return $this->updatePutOperation($pathOperation, $mimeTypes, $collection, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions);
            case 'DELETE':
                return $this->updateDeleteOperation($pathOperation, $resourceShortName);
        }
        return $pathOperation;
    }