This commit is contained in:
2021-09-06 17:46:03 +08:00
parent 93c0fc88d5
commit c4e60ede3d
3 changed files with 31 additions and 39 deletions
+28 -28
View File
@@ -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());
}
}