26 lines
572 B
PHP
26 lines
572 B
PHP
<?php
|
|
// ContentTypeHeader.php
|
|
// Created: 2022-02-14
|
|
// Updated: 2022-02-27
|
|
|
|
namespace Index\Http\Headers;
|
|
|
|
use Index\MediaType;
|
|
use Index\Http\HttpHeader;
|
|
|
|
class ContentTypeHeader {
|
|
private MediaType $mediaType;
|
|
|
|
public function __construct(MediaType $mediaType) {
|
|
$this->mediaType = $mediaType;
|
|
}
|
|
|
|
public function getMediaType(): MediaType {
|
|
return $this->mediaType;
|
|
}
|
|
|
|
public static function parse(HttpHeader $header): ContentTypeHeader {
|
|
return new ContentTypeHeader(MediaType::parse($header->getFirstLine()));
|
|
}
|
|
}
|