| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function render() |
||
| 40 | { |
||
| 41 | // We want to render the specified Twig template to the output buffer. |
||
| 42 | // The simplest way to do that is Slim::render, but that is not allowed |
||
| 43 | // in middleware, because it uses Slim\View::display which prints |
||
| 44 | // directly to the native PHP output buffer. |
||
| 45 | // Doing that is problematic, because the HTTP headers set via $app->response() |
||
| 46 | // must be output first, which won't happen until after the middleware |
||
| 47 | // is completed. Output of headers and body is done by the Slim::run entry point. |
||
| 48 | |||
| 49 | // The below is copied from Slim::render (slim/[email protected]). |
||
| 50 | // Modified to use View::fetch + Response::write, instead of View::display. |
||
| 51 | $this->app->view->appendData($this->_templateVars); |
||
| 52 | $body = $this->app->view->fetch($this->_template); |
||
| 53 | $this->app->response->write($body); |
||
| 54 | } |
||
| 55 | |||
| 61 |