@@ -14,7 +14,7 @@ |
||
| 14 | 14 | * "dsn" => "sqlite:memory::", |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | -if ($_SERVER["SERVER_NAME"] === "www.student.bth.se") { |
|
| 17 | +if ($_SERVER[ "SERVER_NAME" ]==="www.student.bth.se") { |
|
| 18 | 18 | return [ |
| 19 | 19 | "dsn" => "mysql:host=blu-ray.student.bth.se;dbname=mos;", |
| 20 | 20 | "username" => "mos", |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | "info" => "Just say hi with a string.", |
| 14 | 14 | "method" => null, |
| 15 | 15 | "path" => "hi", |
| 16 | - "handler" => function () { |
|
| 16 | + "handler" => function() { |
|
| 17 | 17 | //echo "Ho"; |
| 18 | 18 | return "Hi."; |
| 19 | 19 | }, |
@@ -16,22 +16,22 @@ discard block |
||
| 16 | 16 | [ |
| 17 | 17 | "info" => "Just say hi with a string.", |
| 18 | 18 | "path" => "hi", |
| 19 | - "handler" => function () { |
|
| 19 | + "handler" => function() { |
|
| 20 | 20 | return "Hi."; |
| 21 | 21 | }, |
| 22 | 22 | ], |
| 23 | 23 | [ |
| 24 | 24 | "info" => "Say No! with status code 500.", |
| 25 | 25 | "path" => "no", |
| 26 | - "handler" => function () { |
|
| 27 | - return ["No!", 500]; |
|
| 26 | + "handler" => function() { |
|
| 27 | + return [ "No!", 500 ]; |
|
| 28 | 28 | }, |
| 29 | 29 | ], |
| 30 | 30 | [ |
| 31 | 31 | "info" => "Say Hi through JSON.", |
| 32 | 32 | "path" => "json", |
| 33 | - "handler" => function () { |
|
| 34 | - return [["message" => "Hi JSON"]]; |
|
| 33 | + "handler" => function() { |
|
| 34 | + return [ [ "message" => "Hi JSON" ] ]; |
|
| 35 | 35 | }, |
| 36 | 36 | ], |
| 37 | 37 | [ |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | [ |
| 48 | 48 | "info" => "Throw standard exception.", |
| 49 | 49 | "path" => "exception", |
| 50 | - "handler" => function () { |
|
| 50 | + "handler" => function() { |
|
| 51 | 51 | throw new \Exception("Standard \Exception"); |
| 52 | 52 | }, |
| 53 | 53 | ], |
| 54 | 54 | [ |
| 55 | 55 | "info" => "Try internal 403.", |
| 56 | 56 | "path" => "403", |
| 57 | - "handler" => function () { |
|
| 57 | + "handler" => function() { |
|
| 58 | 58 | throw new ForbiddenException("Detailed error message."); |
| 59 | 59 | }, |
| 60 | 60 | ], |
| 61 | 61 | [ |
| 62 | 62 | "info" => "Try internal 404.", |
| 63 | 63 | "path" => "404", |
| 64 | - "handler" => function () { |
|
| 64 | + "handler" => function() { |
|
| 65 | 65 | throw new NotFoundException("Detailed error message."); |
| 66 | 66 | }, |
| 67 | 67 | ], |
| 68 | 68 | [ |
| 69 | 69 | "info" => "Try internal 500.", |
| 70 | 70 | "path" => "500", |
| 71 | - "handler" => function () { |
|
| 71 | + "handler" => function() { |
|
| 72 | 72 | throw new InternalErrorException("Detailed error message."); |
| 73 | 73 | }, |
| 74 | 74 | ], |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | "basePath" => ANAX_INSTALL_PATH . "/cache/anax", |
| 9 | 9 | |
| 10 | 10 | // Default time to live until item expires |
| 11 | - "timeToLive" => 7 * 24 * 60 * 60, |
|
| 11 | + "timeToLive" => 7*24*60*60, |
|
| 12 | 12 | ]; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | * "dsn" => "sqlite:memory::", |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | -if ($_SERVER["SERVER_NAME"] === "www.student.bth.se") { |
|
| 17 | +if ($_SERVER[ "SERVER_NAME" ]==="www.student.bth.se") { |
|
| 18 | 18 | return [ |
| 19 | 19 | "dsn" => "mysql:host=blu-ray.student.bth.se;dbname=qipa19;", |
| 20 | 20 | "username" => "qipa19", |
@@ -8,22 +8,22 @@ |
||
| 8 | 8 | "services" => [ |
| 9 | 9 | "page" => [ |
| 10 | 10 | "shared" => true, |
| 11 | - "callback" => function () { |
|
| 11 | + "callback" => function() { |
|
| 12 | 12 | $page = new \Anax\Page\Page(); |
| 13 | 13 | $page->setDI($this); |
| 14 | 14 | |
| 15 | 15 | // Load the configuration files |
| 16 | 16 | $cfg = $this->get("configuration"); |
| 17 | 17 | $config = $cfg->load("page.php"); |
| 18 | - $file = $config["file"] ?? null; |
|
| 18 | + $file = $config[ "file" ] ?? null; |
|
| 19 | 19 | |
| 20 | 20 | // Add all views from configuration |
| 21 | - $views = $config["config"]["views"] ?? []; |
|
| 21 | + $views = $config[ "config" ][ "views" ] ?? [ ]; |
|
| 22 | 22 | foreach ($views as $view) { |
| 23 | 23 | $page->add($view); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $layout = $config["config"]["layout"] ?? null; |
|
| 26 | + $layout = $config[ "config" ][ "layout" ] ?? null; |
|
| 27 | 27 | if (!$layout) { |
| 28 | 28 | throw new Exception("Missing configuration for layout in file '$file', its needed."); |
| 29 | 29 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | "services" => [ |
| 7 | 7 | "url" => [ |
| 8 | 8 | "shared" => true, |
| 9 | - "callback" => function () { |
|
| 9 | + "callback" => function() { |
|
| 10 | 10 | $url = new \Anax\Url\Url(); |
| 11 | 11 | $request = $this->get("request"); |
| 12 | 12 | $url->setSiteUrl($request->getSiteUrl()); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | "services" => [ |
| 8 | 8 | "dbqb" => [ |
| 9 | 9 | "shared" => true, |
| 10 | - "callback" => function () { |
|
| 10 | + "callback" => function() { |
|
| 11 | 11 | $db = new \Anax\DatabaseQueryBuilder\DatabaseQueryBuilder(); |
| 12 | 12 | |
| 13 | 13 | // Load the configuration files |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $config = $cfg->load("database"); |
| 16 | 16 | |
| 17 | 17 | // Set the database configuration |
| 18 | - $connection = $config["config"] ?? []; |
|
| 18 | + $connection = $config[ "config" ] ?? [ ]; |
|
| 19 | 19 | $db->setOptions($connection); |
| 20 | 20 | $db->setDefaultsFromConfiguration(); |
| 21 | 21 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | "response" => [ |
| 10 | 10 | "shared" => true, |
| 11 | 11 | //"callback" => "\Anax\Response\Response", |
| 12 | - "callback" => function () { |
|
| 12 | + "callback" => function() { |
|
| 13 | 13 | $obj = new \Anax\Response\ResponseUtility(); |
| 14 | 14 | $obj->setDI($this); |
| 15 | 15 | return $obj; |