1 | <?php |
||
2 | /** |
||
3 | * Create routes using $app programming style. |
||
4 | */ |
||
5 | //var_dump(array_keys(get_defined_vars())); |
||
6 | |||
7 | |||
8 | |||
9 | /** |
||
10 | * Showing message Hello World, not using the standard page layout. |
||
11 | */ |
||
12 | $app->router->get("lek/hello-world", function () use ($app) { |
||
0 ignored issues
–
show
|
|||
13 | // echo "Some debugging information"; |
||
14 | return "Hello World"; |
||
15 | }); |
||
16 | |||
17 | |||
18 | |||
19 | /** |
||
20 | * Returning a JSON message with Hello World. |
||
21 | */ |
||
22 | $app->router->get("lek/hello-world-json", function () use ($app) { |
||
0 ignored issues
–
show
|
|||
23 | // echo "Some debugging information"; |
||
24 | return [["message" => "Hello World"]]; |
||
25 | }); |
||
26 | |||
27 | |||
28 | |||
29 | /** |
||
30 | * Showing message Hello World, rendered within the standard page layout. |
||
31 | */ |
||
32 | $app->router->get("lek/hello-world-page", function () use ($app) { |
||
33 | $title = "Hello World as a page"; |
||
34 | $data = [ |
||
35 | "class" => "hello-world", |
||
36 | "content" => "Hello World in " . __FILE__, |
||
37 | ]; |
||
38 | |||
39 | $app->page->add("anax/v2/article/default", $data); |
||
40 | |||
41 | return $app->page->render([ |
||
42 | "title" => $title, |
||
43 | ]); |
||
44 | }); |
||
45 |
This check looks for imports that have been defined, but are not used in the scope.