25 lines
513 B
PHP
25 lines
513 B
PHP
<?php
|
|
// ContentLengthHeader.php
|
|
// Created: 2022-02-14
|
|
// Updated: 2022-02-27
|
|
|
|
namespace Index\Http\Headers;
|
|
|
|
use Index\Http\HttpHeader;
|
|
|
|
class ContentLengthHeader {
|
|
private int $length;
|
|
|
|
public function __construct(int $length) {
|
|
$this->length = $length;
|
|
}
|
|
|
|
public function getLength(): int {
|
|
return $this->length;
|
|
}
|
|
|
|
public static function parse(HttpHeader $header): ContentLengthHeader {
|
|
return new ContentLengthHeader(intval($header->getFirstLine()));
|
|
}
|
|
}
|