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