改名
This commit is contained in:
@@ -81,11 +81,7 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
private static function loadByContext($id, $default = null, $coroutineId = null): mixed
|
private static function loadByContext($id, $default = null, $coroutineId = null): mixed
|
||||||
{
|
{
|
||||||
$data = Coroutine::getContext($coroutineId)[$id] ?? null;
|
return Coroutine::getContext($coroutineId)[$id] ?? $default;
|
||||||
if ($data === null) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -96,11 +92,7 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
private static function loadByStatic($id, $default = null): mixed
|
private static function loadByStatic($id, $default = null): mixed
|
||||||
{
|
{
|
||||||
$data = static::$_contents[$id] ?? null;
|
return static::$_contents[$id] ?? $default;
|
||||||
if ($data === null) {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Request implements RequestInterface
|
|||||||
*/
|
*/
|
||||||
private function __call__(): RequestInterface
|
private function __call__(): RequestInterface
|
||||||
{
|
{
|
||||||
return Context::getContext(RequestMessage::class);
|
return Context::getContext(RequestMessage::class, new RequestMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace Server\Constrict;
|
|||||||
|
|
||||||
|
|
||||||
use Http\Context\Context;
|
use Http\Context\Context;
|
||||||
use Server\ResponseInterface;
|
|
||||||
use Server\Message\Response as Psr7Response;
|
use Server\Message\Response as Psr7Response;
|
||||||
|
use Server\ResponseInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,34 +22,34 @@ class Response implements ResponseInterface
|
|||||||
const HTML = 'html';
|
const HTML = 'html';
|
||||||
const FILE = 'file';
|
const FILE = 'file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $args
|
* @param $args
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __call($name, $args)
|
public function __call($name, $args)
|
||||||
{
|
{
|
||||||
if (!method_exists($this, $name)) {
|
if (!method_exists($this, $name)) {
|
||||||
return $this->__call__()->{$name}(...$args);
|
return $this->__call__()->{$name}(...$args);
|
||||||
}
|
}
|
||||||
return $this->{$name}(...$args);
|
return $this->{$name}(...$args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get(string $name)
|
public function __get(string $name)
|
||||||
{
|
{
|
||||||
return $this->__call__()->{$name};
|
return $this->__call__()->{$name};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Psr7Response
|
* @return Psr7Response
|
||||||
*/
|
*/
|
||||||
public function __call__(): Psr7Response
|
public function __call__(): Psr7Response
|
||||||
{
|
{
|
||||||
return Context::getContext(Psr7Response::class);
|
return Context::getContext(Psr7Response::class, new Psr7Response());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user