This commit is contained in:
as2252258@163.com
2021-09-10 03:33:45 +08:00
parent 9915452311
commit a61e663cf0
9 changed files with 1192 additions and 140 deletions
+90
View File
@@ -0,0 +1,90 @@
<?php
namespace Protocol\Message;
use BadMethodCallException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;
/**
*
*/
abstract class Request implements RequestInterface
{
use Message;
/**
* @var \Psr\Http\Message\UriInterface
*/
protected UriInterface $uriInterface;
/**
* @var string
*/
protected string $method;
/**
* @return string
*/
public function getRequestTarget(): string
{
throw new BadMethodCallException('Not Accomplish Method.');
}
/**
* @param mixed $requestTarget
* @return static
*/
public function withRequestTarget($requestTarget): static
{
throw new BadMethodCallException('Not Accomplish Method.');
}
/**
* @return string
*/
public function getMethod(): string
{
return $this->method;
}
/**
* @param string $method
* @return RequestInterface
*/
public function withMethod($method): RequestInterface
{
$this->method = $method;
return $this;
}
/**
* @return UriInterface
*/
public function getUri(): UriInterface
{
return $this->uriInterface;
}
/**
* @param UriInterface $uri
* @param false $preserveHost
* @return $this|Request
*/
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface
{
$this->uriInterface = $uri;
return $this;
}
}