1 <?php
2
3 namespace Controller;
4
5 use Alo\Controller\AbstractController;
6
7 if (!defined('GEN_START')) {
8 http_response_code(404);
9 } else {
10
11 /**
12 * A sample controller
13 *
14 * @author Art <a.molcanovas@gmail.com>
15 */
16 class Sample extends AbstractController {
17
18 /**
19 * Default index page
20 *
21 * @author Art <a.molcanovas@gmail.com>
22 */
23 function index() {
24 $this->loadView('sample', ['foo' => 'bar']);
25 }
26
27 /**
28 * Sample method for a more complex route
29 *
30 * @author Art <a.molcanovas@gmail.com>
31 *
32 * @param string $first The first string to echo
33 * @param string $second The second string to echo
34 */
35 function echoer($first = '[not supplied]', $second = '[not supplied]') {
36 echo 'Your first param was ' . $first . ' and your second was ' . $second;
37 }
38
39 /**
40 * Sample method for when the class parameter isn't supplied.
41 *
42 * @author Art <a.molcanovas@gmail.com>
43 */
44 function noclass() {
45 echo 'You\'re in the noclass method! Your routed args are ' . implode(', ', func_get_args());
46 }
47
48 /**
49 * Sample method for the final route test
50 *
51 * @author Art <a.molcanovas@gmail.com>
52 */
53 function noparam() {
54 echo 'You\'re in the no-param method!';
55 }
56
57 /**
58 * Sample method for showing parameters
59 *
60 * @author Art <a.molcanovas@gmail.com>
61 */
62 function paramed() {
63 $vars = func_get_args();
64 echo 'Your path params are' . ($vars ? ' ' . implode(', ', $vars) : '... not set.');
65 }
66 }
67 }
68