@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/config.php'; |
|
8 | +require __DIR__ . '/config.php'; |
|
9 | 9 | |
10 | 10 | |
11 | 11 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // Create a default route to catch all |
34 | -$app->router->add('*', function () use ($app, $pages) { |
|
34 | +$app->router->add('*', function() use ($app, $pages) { |
|
35 | 35 | |
36 | 36 | // Get current route |
37 | 37 | $route = $app->request->getRoute(); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/config.php'; |
|
8 | +require __DIR__ . '/config.php'; |
|
9 | 9 | |
10 | 10 | // Create services and inject into the app. |
11 | 11 | $di = new \Anax\DI\CDIFactoryDefault(); |
@@ -5,20 +5,20 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/config.php'; |
|
8 | +require __DIR__ . '/config.php'; |
|
9 | 9 | |
10 | 10 | // Create services and inject into the app. |
11 | -$di = new \Anax\DI\CDIFactoryDefault(); |
|
11 | +$di = new \Anax\DI\CDIFactoryDefault(); |
|
12 | 12 | |
13 | 13 | $di->set('form', '\Mos\HTMLForm\CForm'); |
14 | 14 | |
15 | -$di->set('FormController', function () use ($di) { |
|
15 | +$di->set('FormController', function() use ($di) { |
|
16 | 16 | $controller = new \Anax\HTMLForm\FormController(); |
17 | 17 | $controller->setDI($di); |
18 | 18 | return $controller; |
19 | 19 | }); |
20 | 20 | |
21 | -$di->set('FormSmallController', function () use ($di) { |
|
21 | +$di->set('FormSmallController', function() use ($di) { |
|
22 | 22 | $controller = new \Anax\HTMLForm\FormSmallController(); |
23 | 23 | $controller->setDI($di); |
24 | 24 | return $controller; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $app = new \Anax\MVC\CApplicationBasic($di); |
28 | 28 | |
29 | 29 | // Home route |
30 | -$app->router->add('', function () use ($app) { |
|
30 | +$app->router->add('', function() use ($app) { |
|
31 | 31 | |
32 | 32 | $app->theme->setTitle("Testing CForm with Anax"); |
33 | 33 | $app->views->add('default/page', [ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // Test form route |
57 | -$app->router->add('test1', function () use ($app) { |
|
57 | +$app->router->add('test1', function() use ($app) { |
|
58 | 58 | |
59 | 59 | $app->session(); // Will load the session service which also starts the session |
60 | 60 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ], |
78 | 78 | 'submit' => [ |
79 | 79 | 'type' => 'submit', |
80 | - 'callback' => function ($form) { |
|
80 | + 'callback' => function($form) { |
|
81 | 81 | $form->AddOutput("<p><i>DoSubmit(): Form was submitted. Do stuff (save to database) and return true (success) or false (failed processing form)</i></p>"); |
82 | 82 | $form->AddOutput("<p><b>Name: " . $form->Value('name') . "</b></p>"); |
83 | 83 | $form->AddOutput("<p><b>Email: " . $form->Value('email') . "</b></p>"); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ], |
89 | 89 | 'submit-fail' => [ |
90 | 90 | 'type' => 'submit', |
91 | - 'callback' => function ($form) { |
|
91 | + 'callback' => function($form) { |
|
92 | 92 | $form->AddOutput("<p><i>DoSubmitFail(): Form was submitted but I failed to process/save/validate it</i></p>"); |
93 | 93 | return false; |
94 | 94 | } |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | */ |
138 | 138 | |
139 | 139 | |
140 | - $callbackSuccess = function ($form) use ($app) { |
|
140 | + $callbackSuccess = function($form) use ($app) { |
|
141 | 141 | // What to do if the form was submitted? |
142 | 142 | $form->AddOUtput("<p><i>Form was submitted and the callback method returned true.</i></p>"); |
143 | 143 | $app->redirectTo(); |
144 | 144 | }; |
145 | 145 | |
146 | - $callbackFail = function ($form) use ($app) { |
|
146 | + $callbackFail = function($form) use ($app) { |
|
147 | 147 | // What to do when form could not be processed? |
148 | 148 | $form->AddOutput("<p><i>Form was submitted and the Check() method returned false.</i></p>"); |
149 | 149 | $app->redirectTo(); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | // Prepare the page content |
13 | 13 | $app->theme->setVariable('title', "Hello World Pagecontroller") |
14 | - ->setVariable('main', " |
|
14 | + ->setVariable('main', " |
|
15 | 15 | <h1>Hello World Pagecontroller</h1> |
16 | 16 | <p>This is a sample pagecontroller that shows how to use Anax.</p> |
17 | 17 | "); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader and the $app-object. |
8 | -require __DIR__.'/config_with_app.php'; |
|
8 | +require __DIR__ . '/config_with_app.php'; |
|
9 | 9 | |
10 | 10 | |
11 | 11 |
@@ -42,8 +42,8 @@ |
||
42 | 42 | // Prepare the page content |
43 | 43 | |
44 | 44 | $app->theme->addStylesheet("css/dice.css") |
45 | - ->setVariable('title', "Throw a dice") |
|
46 | - ->setVariable('main', " |
|
45 | + ->setVariable('title', "Throw a dice") |
|
46 | + ->setVariable('main', " |
|
47 | 47 | <h1>Throw a dice</h1> |
48 | 48 | <p>This is a sample pagecontroller showing how to use <i>application specific modules</i> in a pagecontroller.</p> |
49 | 49 | <p>How many rolls do you want to do, <a href='?roll=1'>1 roll</a>, <a href='?roll=3'>3 rolls</a> or <a href='?roll=6'>6 rolls</a>? </p> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/config_with_app.php'; |
|
8 | +require __DIR__ . '/config_with_app.php'; |
|
9 | 9 | |
10 | 10 | |
11 | 11 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | ? $_GET['roll'] |
18 | 18 | : 0; |
19 | 19 | |
20 | -if($roll > 100) { |
|
20 | +if ($roll > 100) { |
|
21 | 21 | throw new Exception("To many rolls on the dice. Not allowed."); |
22 | 22 | } |
23 | 23 | |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | // Make roll and prepare reply |
27 | 27 | $html = null; |
28 | -if($roll) { |
|
28 | +if ($roll) { |
|
29 | 29 | $dice->roll($roll); |
30 | 30 | |
31 | 31 | $html = "<p>You made {$roll} roll(s) and you got this serie.</p>\n<ul class='dice'>"; |
32 | - foreach($dice->getResults() as $val) { |
|
32 | + foreach ($dice->getResults() as $val) { |
|
33 | 33 | $html .= "\n<li class='dice-{$val}'></li>"; |
34 | 34 | } |
35 | 35 | $html .= "\n</ul>\n"; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/../config.php'; |
|
8 | +require __DIR__ . '/../config.php'; |
|
9 | 9 | |
10 | 10 | // Create services and inject into the app. |
11 | 11 | $di = new \Anax\DI\CDIFactoryTest(); |
12 | 12 | $app = new \Anax\Kernel\CAnax($di); |
13 | 13 | |
14 | 14 | |
15 | -$di->set('TestController', function () use ($di) { |
|
15 | +$di->set('TestController', function() use ($di) { |
|
16 | 16 | $controller = new TestController(); |
17 | 17 | $controller->setDI($di); |
18 | 18 | return $controller; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | -$app->router->add('', function () use ($app) { |
|
75 | +$app->router->add('', function() use ($app) { |
|
76 | 76 | |
77 | 77 | $app->dispatcher->forward(['controller' => 'test']); |
78 | 78 | }); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/../config.php'; |
|
8 | +require __DIR__ . '/../config.php'; |
|
9 | 9 | |
10 | 10 | |
11 | 11 | // Create services and inject into the app. |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | // Create the home route |
18 | -$app->router->add('*', function () use ($app) { |
|
18 | +$app->router->add('*', function() use ($app) { |
|
19 | 19 | |
20 | 20 | $app->theme->setTitle("Creating urls"); |
21 | 21 | $app->views->add('default/page', [ |
@@ -5,14 +5,14 @@ |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Get environment & autoloader. |
8 | -require __DIR__.'/../config.php'; |
|
8 | +require __DIR__ . '/../config.php'; |
|
9 | 9 | |
10 | 10 | // Create services and inject into the app. |
11 | 11 | $di = new \Anax\DI\CDIFactoryTest(); |
12 | 12 | $app = new \Anax\Kernel\CAnax($di); |
13 | 13 | |
14 | 14 | |
15 | -$app->router->add('', function () use ($app, $di) { |
|
15 | +$app->router->add('', function() use ($app, $di) { |
|
16 | 16 | |
17 | 17 | $html = "<pre>" . print_r($di->getServices(), true) . "</pre>"; |
18 | 18 | $html .= "<h2>These services are active</h2>"; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | // Get environment & autoloader. |
7 | -require __DIR__.'/../config.php'; |
|
7 | +require __DIR__ . '/../config.php'; |
|
8 | 8 | |
9 | 9 | // Create services and inject into the app. |
10 | 10 | $di = new \Anax\DI\CDIFactoryTest(); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | // Home route |
16 | -$app->router->add('', function () use ($app) { |
|
16 | +$app->router->add('', function() use ($app) { |
|
17 | 17 | |
18 | 18 | $app->theme->setTitle("Throw exceptions to generate HTTP error pages"); |
19 | 19 | $app->views->add('default/page', [ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | // Throw ForbiddenException to get a 403 page |
43 | -$app->router->add('403', function () use ($app) { |
|
43 | +$app->router->add('403', function() use ($app) { |
|
44 | 44 | |
45 | 45 | throw new \Anax\Exception\ForbiddenException("Here is the details, if any."); |
46 | 46 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | // Throw NotFoundException to get a 404 page |
52 | -$app->router->add('404', function () use ($app) { |
|
52 | +$app->router->add('404', function() use ($app) { |
|
53 | 53 | |
54 | 54 | throw new \Anax\Exception\NotFoundException("Here is the details, if any."); |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | // Throw InternalServerErrorException to get a 500 page |
61 | -$app->router->add('500', function () use ($app) { |
|
61 | +$app->router->add('500', function() use ($app) { |
|
62 | 62 | |
63 | 63 | throw new \Anax\Exception\InternalServerErrorException("Here is the details, if any."); |
64 | 64 |