| @@ -1,47 +1,47 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace Patchstack; | |
| 4 | - | |
| 5 | -class Response | |
| 6 | -{ | |
| 7 | - /** | |
| 8 | - * The options of the engine. | |
| 9 | - * | |
| 10 | - * @var array | |
| 11 | - */ | |
| 12 | - private $options; | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * Creates a new request instance. | |
| 16 | - * | |
| 17 | - * @param array $options | |
| 18 | - * @return void | |
| 19 | - */ | |
| 20 | - public function __construct($options = []) | |
| 21 | - { | |
| 22 | - $this->options = $options; | |
| 23 | - } | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * Perform a redirect if the request must be redirected to somewhere else. | |
| 27 | - * | |
| 28 | - * @param string $redirectTo | |
| 29 | - * @param boolean $mustExit | |
| 30 | - * @return void | |
| 31 | - */ | |
| 32 | - public function redirect($redirectTo = '', $mustExit = true) | |
| 33 | - { | |
| 34 | - // Don't redirect an invalid URL. | |
| 35 | - if (!$redirectTo || filter_var($redirectTo, FILTER_VALIDATE_URL) === false) { | |
| 36 | - return false; | |
| 37 | - } | |
| 38 | - | |
| 39 | - // Perform the redirect. | |
| 40 | - header('Location: ' . $redirectTo, true, 302); | |
| 41 | - | |
| 42 | - // In some scenarios we might want to control if the script should exit executing. | |
| 43 | - if ($mustExit) { | |
| 44 | - exit; | |
| 45 | - } | |
| 46 | - } | |
| 47 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace Patchstack; | |
| 4 | + | |
| 5 | +class Response | |
| 6 | +{ | |
| 7 | + /** | |
| 8 | + * The options of the engine. | |
| 9 | + * | |
| 10 | + * @var array | |
| 11 | + */ | |
| 12 | + private $options; | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * Creates a new request instance. | |
| 16 | + * | |
| 17 | + * @param array $options | |
| 18 | + * @return void | |
| 19 | + */ | |
| 20 | + public function __construct($options = []) | |
| 21 | + { | |
| 22 | + $this->options = $options; | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Perform a redirect if the request must be redirected to somewhere else. | |
| 27 | + * | |
| 28 | + * @param string $redirectTo | |
| 29 | + * @param boolean $mustExit | |
| 30 | + * @return void | |
| 31 | + */ | |
| 32 | + public function redirect($redirectTo = '', $mustExit = true) | |
| 33 | + { | |
| 34 | + // Don't redirect an invalid URL. | |
| 35 | + if (!$redirectTo || filter_var($redirectTo, FILTER_VALIDATE_URL) === false) { | |
| 36 | + return false; | |
| 37 | + } | |
| 38 | + | |
| 39 | + // Perform the redirect. | |
| 40 | + header('Location: ' . $redirectTo, true, 302); | |
| 41 | + | |
| 42 | + // In some scenarios we might want to control if the script should exit executing. | |
| 43 | + if ($mustExit) { | |
| 44 | + exit; | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | |