parse() public static method

Parse media type.
public static parse ( integer $position, string $mediaType ) : MediaType
$position integer
$mediaType string
return MediaType
Example #1
0
 /**
  * @param int    $position
  * @param string $mediaType
  *
  * @return MediaTypeInterface
  */
 protected static function parseMediaType($position, $mediaType)
 {
     return MediaType::parse($position, $mediaType);
 }
 /**
  * @param string $mediaType
  * @return MediaTypeInterface
  */
 private function normalizeMediaType($mediaType)
 {
     return MediaType::parse(0, $mediaType);
 }
 /**
  * @param string $mediaType
  * @return $this
  */
 private function withMediaType($mediaType = MediaTypeInterface::JSON_API_MEDIA_TYPE)
 {
     $mediaType = MediaType::parse(0, $mediaType);
     $this->codecMatcher->registerEncoder($mediaType, function () {
         return Encoder::instance();
     });
     $this->codecMatcher->registerDecoder($mediaType, function () {
         return new DocumentDecoder();
     });
     return $this;
 }