| Conditions | 5 |
| Paths | 8 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function __construct($url, $htmx = false, $parse = true, $code = 302, $redirect_after = null ) |
||
| 13 | { |
||
| 14 | if ($this->isLocalUrl($url) && $parse) { |
||
| 15 | $parsedUrl = Application::getDir()."/".$url; |
||
| 16 | } else { |
||
| 17 | $parsedUrl = $url; |
||
| 18 | } |
||
| 19 | if ($htmx) { |
||
| 20 | $headers = ["HX-Redirect" => $parsedUrl]; |
||
| 21 | } else { |
||
| 22 | $headers = [ "Location" => $parsedUrl ]; |
||
| 23 | } |
||
| 24 | if(isset($redirect_after)){ |
||
| 25 | $_SESSION["redirect_url"] = $redirect_after; |
||
| 26 | |||
| 27 | } |
||
| 28 | parent::__construct(body: '', statusCode: $code, headers: $headers); |
||
| 29 | } |
||
| 39 |