25 lines
510 B
PHP
25 lines
510 B
PHP
<?php
|
|
// ContentLengthHeader.php
|
|
// Created: 2022-02-14
|
|
// Updated: 2023-01-01
|
|
|
|
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((int)$header->getFirstLine());
|
|
}
|
|
}
|