This commit is contained in:
2021-08-27 17:06:17 +08:00
parent 2f76d86069
commit daef261403
8 changed files with 62 additions and 37 deletions
+14 -1
View File
@@ -23,7 +23,10 @@ class Request implements RequestInterface
public string $method;
public UriInterface $uri;
/**
* @var Uri
*/
private Uri $uri;
private \Swoole\Http\Request $serverRequest;
@@ -152,6 +155,16 @@ class Request implements RequestInterface
}
/**
* @param string $method
* @return bool
*/
public function isMethod(string $method): bool
{
return $this->method === $method;
}
/**
* @param string $method
* @return RequestInterface
+18
View File
@@ -33,6 +33,24 @@ class Uri implements UriInterface
public string $password = '';
private array $_explode = [];
/**
* @return string[]
*/
public function getExplode(): array
{
if ($this->path == '/' || $this->path == '') {
return [''];
}
if (empty($this->_explode)) {
$this->_explode = array_filter(explode('/', $this->path));
}
return $this->_explode;
}
/**
* @return string
*/