ApiPlatform\Core\EventListener\DeserializeListener::getFormat PHP Метод

getFormat() приватный метод

Extracts the format from the Content-Type header and check that it is supported.
private getFormat ( Request $request ) : string
$request Symfony\Component\HttpFoundation\Request
Результат string
    private function getFormat(Request $request) : string
    {
        $contentType = $request->headers->get('CONTENT_TYPE');
        if (null === $contentType) {
            throw new NotAcceptableHttpException('The "Content-Type" header must exist.');
        }
        $format = $request->getFormat($contentType);
        if (!isset($this->formats[$format])) {
            $supportedMimeTypes = [];
            foreach ($this->formats as $mimeTypes) {
                foreach ($mimeTypes as $mimeType) {
                    $supportedMimeTypes[] = $mimeType;
                }
            }
            throw new NotAcceptableHttpException(sprintf('The content-type "%s" is not supported. Supported MIME types are "%s".', $contentType, implode('", "', $supportedMimeTypes)));
        }
        return $format;
    }