1 | <?php |
||
5 | class Render |
||
6 | { |
||
7 | private $twig; |
||
8 | |||
9 | public function __construct($twig) |
||
10 | { |
||
11 | $this->twig = $twig; |
||
12 | } |
||
13 | |||
14 | public function render($file, $values = []) |
||
20 | |||
21 | public function redirect($url, $code = 302) |
||
26 | |||
27 | public function error($errorCode, $errorMessage, $params) |
||
36 | |||
37 | public function finish() |
||
42 | } |
||
43 |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.