20231009#1

This commit is contained in:
User
2023-10-09 14:12:18 +03:00
parent 7658fc88e6
commit 2a620798b3

View File

@@ -74,10 +74,8 @@ class App extends Main {
* 2. Если итерации закончились и задан обьект Content им создаем результат для эмиттера * 2. Если итерации закончились и задан обьект Content им создаем результат для эмиттера
*/ */
if($this->template() && !empty($this->template()->getResponse())){ if($this->template() && !empty($this->template()->getResponse())){
$body = $this->globals()->response()->getBody(); $this->globals()->response()->getBody()->write($this->template()->getResponse());
$body->write($this->template()->getResponse()); return$this->globals()->response();
$body->rewind();
return $this->globals()->response()->withBody($body);
} }
/** /**
* 3. Отдаем пустой результат если не определен шаблонизатор * 3. Отдаем пустой результат если не определен шаблонизатор
@@ -112,10 +110,7 @@ class App extends Main {
*/ */
private function defaultPage(int $code) : ResponseInterface{ private function defaultPage(int $code) : ResponseInterface{
if(is_file($this->baseDir.'/'.getenv("PAGE".$code))){ if(is_file($this->baseDir.'/'.getenv("PAGE".$code))){
$body = $this->globals()->response()->getBody(); $this->globals()->response()->getBody()->write(file_get_contents($this->baseDir.'/'.getenv("PAGE".$code)));
$body->write(file_get_contents($this->baseDir.'/'.getenv("PAGE".$code)));
$body->rewind();
return $this->globals()->response()->withBody($body)->withStatus($code);
} }
return $this->globals()->response()->withStatus($code); return $this->globals()->response()->withStatus($code);
} }