28 lines
698 B
PHP
28 lines
698 B
PHP
<?php
|
|
// AccessControlRequestMethodHeader.php
|
|
// Created: 2022-02-14
|
|
// Updated: 2022-02-27
|
|
|
|
namespace Index\Http\Headers;
|
|
|
|
use Index\Http\HttpHeader;
|
|
|
|
class AccessControlRequestMethodHeader {
|
|
private string $method;
|
|
|
|
public function __construct(string $method) {
|
|
$this->method = $method;
|
|
}
|
|
|
|
public function getMethod(): string {
|
|
return $this->method;
|
|
}
|
|
|
|
public function isMethod(string $method): bool {
|
|
return $this->method === strtolower($method);
|
|
}
|
|
|
|
public static function parse(HttpHeader $header): AccessControlRequestMethodHeader {
|
|
return new AccessControlRequestMethodHeader(strtolower(trim($header->getFirstLine())));
|
|
}
|
|
}
|