Beispiel #1
0
 public function execute(ResponseInterface $response) : ResponseInterface
 {
     $this->presentation->define('page-title', 'User Search');
     $users = [];
     foreach ($this->model->search() as $value) {
         $users[] = $value['username'];
     }
     $this->presentation->assign('items', $users);
     $this->presentation->assign('term', $this->model->criteria());
     $response->content()->write($this->presentation->render('users/search'));
     return $response;
 }
Beispiel #2
0
 /**
  * Finishes the application by executing any terminable
  * middleware.
  *
  * @param ResponseInterface $response
  */
 public function finish(ResponseInterface $response)
 {
     $response->send();
     foreach ($this->terminators as $callback) {
         $callback->shutdown();
     }
 }
Beispiel #3
0
 public function execute(ResponseInterface $response) : ResponseInterface
 {
     $this->presentation->define('page-title', 'About');
     $response->content()->write($this->presentation->render('index/about'));
     return $response;
 }
Beispiel #4
0
 /**
  * Executes the view
  *
  * @param ResponseInterface $response
  *
  * @return ResponseInterface
  */
 public function execute(ResponseInterface $response)
 {
     $this->presentation->define('page-title', 'Welcome');
     $response->content()->write($this->presentation->render('index/home.phtml'));
     return $response;
 }
Beispiel #5
0
 /**
  * Attempts to transform an input into a response content
  * body.
  *
  * @param ResponseInterface $response
  * @param mixed             $in
  *
  * @return ResponseInterface
  */
 private function transform(ResponseInterface $response, $in) : ResponseInterface
 {
     $this->interpretation->listen('string|integer|double', function (ResponseInterface $response, $value) {
         $response->content()->write(strval($value));
         return $response;
     });
     $this->interpretation->load($this->configurator->require('paths/interpretation/handlers', 'string'));
     return $this->interpretation->resolve($response, [$this->container, 'call'], $in);
 }