| 1 | <?php |
||
| 12 | class Redirector{ |
||
|
|
|||
| 13 | |||
| 14 | /** |
||
| 15 | * Constructor |
||
| 16 | * |
||
| 17 | */ |
||
| 18 | public function __construct(){ |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Redirect to the given location |
||
| 23 | * |
||
| 24 | * @param string $location |
||
| 25 | */ |
||
| 26 | public function to($location, $query = ""){ |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Redirect to the given location from the root |
||
| 38 | * |
||
| 39 | * @param string $location |
||
| 40 | */ |
||
| 41 | public function root($location = "", $query = ""){ |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Redirect to the dashboard |
||
| 47 | */ |
||
| 48 | public function dashboard(){ |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Redirect to the login page |
||
| 54 | * $redirect_url is to send the user back to where he/she came from after login |
||
| 55 | * |
||
| 56 | * @param string|null $redirect_url |
||
| 57 | */ |
||
| 58 | public function login($redirect_url = null){ |
||
| 65 | |||
| 66 | } |
||
| 67 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.