@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'id' => null, |
29 | 29 | 'class' => null, |
30 | 30 | 'wrapper' => 'nav', |
31 | - 'create_url' => function ($url) { |
|
31 | + 'create_url' => function($url) { |
|
32 | 32 | return $url; |
33 | 33 | }, |
34 | 34 | ); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | // Create the ul li menu from the array, use an anonomous recursive function that returns an |
38 | 38 | // array of values. |
39 | - $createMenu = function ($items, $callback) use (&$createMenu, $menu) { |
|
39 | + $createMenu = function($items, $callback) use (&$createMenu, $menu) { |
|
40 | 40 | |
41 | 41 | $html = null; |
42 | 42 | $hasItemIsSelected = false; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | // Is there a class set for this item, then use it |
71 | - $class = isset($item['class']) && ! is_null($item['class']) |
|
71 | + $class = isset($item['class']) && !is_null($item['class']) |
|
72 | 72 | ? $item['class'] |
73 | 73 | : null; |
74 | 74 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | // Set the id & class element, only if it exists in the menu-array |
99 | - $id = isset($menu['id']) ? " id='{$menu['id']}'" : null; |
|
99 | + $id = isset($menu['id']) ? " id='{$menu['id']}'" : null; |
|
100 | 100 | $class = isset($menu['class']) ? " class='{$menu['class']}'" : null; |
101 | 101 | $wrapper = $menu['wrapper']; |
102 | 102 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
16 | + /** |
|
17 | 17 | * Display a page for a HTTP status code. |
18 | 18 | * |
19 | 19 | * @param string code status code to set the http header. |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Set a message. |
21 | 21 | * |
22 | 22 | * @param string a message. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Get the message. |
35 | 35 | * |
36 | 36 | * @return void |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $param = is_int($key) ? null : $val; |
91 | - $test = $tests[$rule]; |
|
91 | + $test = $tests[$rule]; |
|
92 | 92 | |
93 | 93 | if (is_callable($test['test'])) { |
94 | 94 |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | function mergesort(&$array, $cmp_function) |
34 | 34 | { |
35 | 35 | // Arrays of size < 2 require no action. |
36 | - if (count($array) < 2) return; |
|
36 | + if (count($array) < 2) { |
|
37 | + return; |
|
38 | + } |
|
37 | 39 | // Split the array in half |
38 | 40 | $halfway = count($array) / 2; |
39 | 41 | $array1 = array_slice($array, 0, $halfway); |
@@ -57,7 +59,11 @@ discard block |
||
57 | 59 | } |
58 | 60 | } |
59 | 61 | // Merge the remainder |
60 | - while ($ptr1 < count($array1)) $array[] = $array1[$ptr1++]; |
|
61 | - while ($ptr2 < count($array2)) $array[] = $array2[$ptr2++]; |
|
62 | + while ($ptr1 < count($array1)) { |
|
63 | + $array[] = $array1[$ptr1++]; |
|
64 | + } |
|
65 | + while ($ptr2 < count($array2)) { |
|
66 | + $array[] = $array2[$ptr2++]; |
|
67 | + } |
|
62 | 68 | return; |
63 | 69 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * Properties |
14 | 14 | * |
15 | 15 | */ |
16 | - const URL_CLEAN = 'clean'; // controller/action/param1/param2 |
|
16 | + const URL_CLEAN = 'clean'; // controller/action/param1/param2 |
|
17 | 17 | const URL_APPEND = 'append'; // index.php/controller/action/param1/param2 |
18 | 18 | |
19 | 19 | private $urlType = self::URL_APPEND; // What type of urls to generate |
@@ -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(); |