index/src/Http/Headers/ContentLengthHeader.php

25 lines
510 B
PHP
Raw Normal View History

2022-09-13 13:13:11 +00:00
<?php
// ContentLengthHeader.php
// Created: 2022-02-14
// Updated: 2023-01-01
2022-09-13 13:13:11 +00:00
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());
2022-09-13 13:13:11 +00:00
}
}