robsonvleite /
router
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Test; |
||||
| 4 | |||||
| 5 | /** |
||||
| 6 | * Class Coffee MVC :: CONTROLLER |
||||
| 7 | * @package Test |
||||
| 8 | */ |
||||
| 9 | class Coffee |
||||
| 10 | { |
||||
| 11 | /** |
||||
| 12 | * Coffee constructor. |
||||
| 13 | */ |
||||
| 14 | public function __construct() |
||||
| 15 | { |
||||
| 16 | $url = BASE; |
||||
| 17 | |||||
| 18 | echo "<h1>Router @CoffeeCode</h1>"; |
||||
| 19 | echo "<nav> |
||||
| 20 | <a href='{$url}'>Home</a> |
||||
| 21 | <a href='{$url}/edit/" . rand(44, 244) . "'>Edit</a> |
||||
| 22 | <a href='{$url}/error/'>Error</a> |
||||
| 23 | </nav>"; |
||||
| 24 | } |
||||
| 25 | |||||
| 26 | /** |
||||
| 27 | * @param array $data |
||||
| 28 | */ |
||||
| 29 | public function home(array $data): void |
||||
| 30 | { |
||||
| 31 | echo "<h3>", __METHOD__, "::", $_SERVER["REQUEST_METHOD"], "</h3><hr>"; |
||||
| 32 | echo "<pre>", print_r($data, true), "</pre>"; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 33 | } |
||||
| 34 | |||||
| 35 | /** |
||||
| 36 | * @param array $data |
||||
| 37 | */ |
||||
| 38 | public function edit(array $data): void |
||||
| 39 | { |
||||
| 40 | echo "<h3>", __METHOD__, "::", $_SERVER["REQUEST_METHOD"], "</h3><hr>"; |
||||
| 41 | |||||
| 42 | echo "<form name='coffeecode' method='post' enctype='multipart/form-data'> |
||||
| 43 | <input name=\"first_name\" value=\"Robson\"> |
||||
| 44 | <input name=\"last_name\" value=\"V. Leite\"> |
||||
| 45 | <input name=\"email\" value=\"[email protected]\"> |
||||
| 46 | <button>@CoffeeCode</button> |
||||
| 47 | </form>"; |
||||
| 48 | |||||
| 49 | echo "<pre>", print_r($data, true), "</pre>"; |
||||
|
0 ignored issues
–
show
Are you sure
print_r($data, true) of type string|true can be used in echo?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 50 | } |
||||
| 51 | |||||
| 52 | /** |
||||
| 53 | * @param array $data |
||||
| 54 | */ |
||||
| 55 | public function notfound(array $data): void |
||||
| 56 | { |
||||
| 57 | echo "<h3>Whoops!</h3>", "<pre>", print_r($data, true), "</pre>"; |
||||
|
0 ignored issues
–
show
Are you sure
print_r($data, true) of type string|true can be used in echo?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 58 | } |
||||
| 59 | |||||
| 60 | public function admin(array $data): void |
||||
| 61 | { |
||||
| 62 | echo "<h3>Admin Group:</h3>", "<pre>", print_r($data, true), "</pre>"; |
||||
|
0 ignored issues
–
show
Are you sure
print_r($data, true) of type string|true can be used in echo?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 63 | } |
||||
| 64 | } |