первая страница грузится 6-7 секунд. Это жопа.
class Model {
private $state = 0;
public function getState() {
return $this->state;
}
public function changeState() {
$this->state++;
}
}
class Controller {
private $model;
private $view;
public function __construct(Model $model, View $view) {
$this->model = $model;
$this->view = $view;
}
public function changeStateAction(Aerys\Request $req, Aerys\Response $resp) {
$this->model->changeState();
$resp->send($this->view->serialize($this->model->getState()));
}
}
class View {
public function prepare($modelState) {
return json_encode([
'state' => $modelState
]);
}
}
$model = new Model();
$view = new View();
$controller = new Controller($model, $view);
$router = Aerys\router()->post("/", [$controller, 'handle']);
(new Aerys\Host)
->name("example.com")
->use($router);