public function Request::getFormat

Gets the format associated with the mime type.

@api

Parameters

string $mimeType The associated mime type:

Return value

string|null The format (null if not found)

1 call to Request::getFormat()
Request::getContentType in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Gets the format associated with the request.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 962

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getFormat($mimeType) {
  if (false !== ($pos = strpos($mimeType, ';'))) {
    $mimeType = substr($mimeType, 0, $pos);
  }
  if (null === static::$formats) {
    static::initializeFormats();
  }
  foreach (static::$formats as $format => $mimeTypes) {
    if (in_array($mimeType, (array) $mimeTypes)) {
      return $format;
    }
  }
  return null;
}