Initial commit
This commit is contained in:
30
src/Silex/Http/HttpResponse.php
Normal file
30
src/Silex/Http/HttpResponse.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Silex\Http;
|
||||
|
||||
class HttpResponse
|
||||
{
|
||||
private int $status;
|
||||
|
||||
private string $viewPath;
|
||||
|
||||
private array $viewParams;
|
||||
|
||||
public function __construct(int $status, string $viewPath, array $viewParams = [])
|
||||
{
|
||||
$this->status = $status;
|
||||
$this->viewPath = $viewPath;
|
||||
$this->viewParams = $viewParams;
|
||||
}
|
||||
|
||||
public function render(string $viewBasePath)
|
||||
{
|
||||
$params = $this->viewParams;
|
||||
ob_start();
|
||||
require $viewBasePath . '/' . $this->viewPath . '.php';
|
||||
$content = ob_get_clean();
|
||||
require $viewBasePath . '/layout.php';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user