|
|
|
@ -86,14 +86,38 @@ class Context
|
|
|
|
|
$this->setResponse($fn($this->getResponse()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSetting($name, $default = null) {
|
|
|
|
|
public function getSetting($name, $default = null)
|
|
|
|
|
{
|
|
|
|
|
return $this->settings[$name] ?? $default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getVar($name, $default = null) {
|
|
|
|
|
public function getVar($name, $default = null)
|
|
|
|
|
{
|
|
|
|
|
return $this->settings[$name] ?? $default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getVars(): array
|
|
|
|
|
{
|
|
|
|
|
return $this->vars;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getSettings(): array
|
|
|
|
|
{
|
|
|
|
|
return $this->settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function redirect($to, $status = 302): void {
|
|
|
|
|
$this->withResponse(function (ResponseInterface $response) use ($to, $status) {
|
|
|
|
|
return $response->withStatus($status)->withHeader('Location', $to);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __get($name)
|
|
|
|
|
{
|
|
|
|
|
return $this->context[$name];
|
|
|
|
|