modify
This commit is contained in:
@@ -13,7 +13,7 @@ namespace HttpServer\Http;
|
||||
* Class HttpHeaders
|
||||
* @package Snowflake\Snowflake\Http
|
||||
*/
|
||||
class HttpHeaders
|
||||
trait HttpHeaders
|
||||
{
|
||||
|
||||
private array $_headers = [];
|
||||
@@ -46,17 +46,6 @@ class HttpHeaders
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($name, $default = null): mixed
|
||||
{
|
||||
return $this->_headers[$name] ?? $default;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ use Snowflake\Snowflake;
|
||||
* Class HttpParams
|
||||
* @package Snowflake\Snowflake\Http
|
||||
*/
|
||||
class HttpParams
|
||||
trait HttpParams
|
||||
{
|
||||
|
||||
/** @var array|null */
|
||||
@@ -109,7 +109,7 @@ class HttpParams
|
||||
*/
|
||||
private function page(): int
|
||||
{
|
||||
return (int)$this->get('page', 1);
|
||||
return (int)$this->query('page', 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,19 +129,10 @@ class HttpParams
|
||||
*/
|
||||
public function size(): int
|
||||
{
|
||||
return (int)$this->get('size', 20);
|
||||
return (int)$this->query('size', 20);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $defaultValue
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($name, $defaultValue = null): mixed
|
||||
{
|
||||
return $this->_gets[$name] ?? $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
|
||||
@@ -33,14 +33,12 @@ defined('REQUEST_FAIL') or define('REQUEST_FAIL', 500);
|
||||
class Request extends HttpService implements RequestInterface
|
||||
{
|
||||
|
||||
|
||||
use HttpHeaders, HttpParams;
|
||||
|
||||
public int $fd = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @var HttpParams|null
|
||||
*/
|
||||
#[Inject(HttpParams::class)]
|
||||
public ?HttpParams $params = null;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user