改名
This commit is contained in:
@@ -18,23 +18,15 @@ use Snowflake\Snowflake;
|
||||
/**
|
||||
* Class WebController
|
||||
* @package Snowflake\Snowflake\Web
|
||||
* @property-read HttpParams $input
|
||||
* @property-read HttpHeaders $headers
|
||||
* @property-read Request $request
|
||||
*/
|
||||
class Controller extends HttpService
|
||||
{
|
||||
|
||||
use TraitApplication;
|
||||
|
||||
/** @var null|HttpParams $input */
|
||||
public null|HttpParams $input;
|
||||
|
||||
|
||||
/** @var null|HttpHeaders */
|
||||
public null|HttpHeaders $headers;
|
||||
|
||||
|
||||
/** @var null|Request */
|
||||
public null|Request $request;
|
||||
|
||||
|
||||
/**
|
||||
* Controller constructor.
|
||||
@@ -57,40 +49,13 @@ class Controller extends HttpService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param null|HttpParams $input
|
||||
*/
|
||||
public function setInput(?HttpParams $input): void
|
||||
{
|
||||
$this->input = $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ?HttpHeaders $headers
|
||||
*/
|
||||
public function setHeaders(?HttpHeaders $headers): void
|
||||
{
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ?Request $request
|
||||
*/
|
||||
public function setRequest(?Request $request): void
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?HttpParams
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getInput(): ?HttpParams
|
||||
{
|
||||
if (!$this->input) {
|
||||
$this->input = $this->getRequest()->params;
|
||||
}
|
||||
return $this->input;
|
||||
return \request()->params;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,10 +64,7 @@ class Controller extends HttpService
|
||||
*/
|
||||
public function getHeaders(): ?HttpHeaders
|
||||
{
|
||||
if (!$this->headers && $this->getRequest()) {
|
||||
$this->headers = $this->getRequest()->headers;
|
||||
}
|
||||
return $this->headers;
|
||||
return \request()->headers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,9 +82,7 @@ class Controller extends HttpService
|
||||
/**
|
||||
* @param $name
|
||||
* @return mixed
|
||||
* @throws ComponentException
|
||||
* @throws ReflectionException
|
||||
* @throws NotFindClassException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __get($name): mixed
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user