You are here

public function Request::getFormat in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::getFormat()

Gets the format associated with the mime type.

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 vendor/symfony/http-foundation/Request.php
Gets the format associated with the request.

File

vendor/symfony/http-foundation/Request.php, line 1327

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;
    }
  }
}