@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | |
4 | 4 | class Grid extends \erdiko\Controller |
5 | 5 | { |
6 | - protected $container; |
|
6 | + protected $container; |
|
7 | 7 | |
8 | - public function __invoke($request, $response, $args) |
|
9 | - { |
|
8 | + public function __invoke($request, $response, $args) |
|
9 | + { |
|
10 | 10 | $this->container->logger->debug("/controller"); |
11 | - $view = 'pages/grid.html'; |
|
11 | + $view = 'pages/grid.html'; |
|
12 | 12 | |
13 | 13 | // Get erdiko config, this gets application.json and loads the theme specified |
14 | 14 | $config = \erdiko\theme\Config::get(); |
@@ -31,6 +31,6 @@ discard block |
||
31 | 31 | } |
32 | 32 | $config['items'] = $items; |
33 | 33 | |
34 | - return $this->container->theme->render($response, $view, $config); |
|
35 | - } |
|
34 | + return $this->container->theme->render($response, $view, $config); |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -25,7 +25,7 @@ |
||
25 | 25 | ]; |
26 | 26 | |
27 | 27 | $items = array(); |
28 | - for($i = 0; $i < $args['count']; $i++) { |
|
28 | + for ($i = 0; $i < $args['count']; $i++) { |
|
29 | 29 | $item['name'] = "Item $i"; |
30 | 30 | $items[] = $item; |
31 | 31 | } |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | |
4 | 4 | class Home extends \erdiko\Controller |
5 | 5 | { |
6 | - protected $container; |
|
6 | + protected $container; |
|
7 | 7 | |
8 | - public function __invoke($request, $response, $args) |
|
9 | - { |
|
8 | + public function __invoke($request, $response, $args) |
|
9 | + { |
|
10 | 10 | $this->container->logger->debug("/controller"); |
11 | - $view = 'views/controller.html'; |
|
11 | + $view = 'views/controller.html'; |
|
12 | 12 | |
13 | 13 | // Get erdiko config, this gets application.json and loads the theme specified |
14 | 14 | $config = \erdiko\theme\Config::get(); |
@@ -18,6 +18,6 @@ discard block |
||
18 | 18 | $config['title'] = "Erdiko Controller Example"; |
19 | 19 | $config['args'] = $args; |
20 | 20 | |
21 | - return $this->container->theme->render($response, $view, $config); |
|
22 | - } |
|
21 | + return $this->container->theme->render($response, $view, $config); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -60,10 +60,10 @@ |
||
60 | 60 | 'name' => "Item" |
61 | 61 | ]; |
62 | 62 | $items = array(); |
63 | - $max = (int)$args['param']; |
|
63 | + $max = (int) $args['param']; |
|
64 | 64 | $this->container->logger->debug("param: ".$max); |
65 | 65 | |
66 | - for($i = 0; $i < $max; $i++) { |
|
66 | + for ($i = 0; $i < $max; $i++) { |
|
67 | 67 | $item['name'] = "Item $i"; |
68 | 68 | $items[] = $item; |
69 | 69 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | // Set up dependencies |
3 | -require_once __DIR__ . '/dependencies.php'; |
|
3 | +require_once __DIR__.'/dependencies.php'; |
|
4 | 4 | |
5 | 5 | // Register middleware |
6 | -require_once __DIR__ . '/middleware.php'; |
|
6 | +require_once __DIR__.'/middleware.php'; |
|
7 | 7 | |
8 | 8 | // Register routes |
9 | -require_once __DIR__ . '/routes.php'; |
|
9 | +require_once __DIR__.'/routes.php'; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Routes |
3 | 3 | |
4 | -$app->get('/', function ($request, $response, $args) { |
|
4 | +$app->get('/', function($request, $response, $args) { |
|
5 | 5 | // Sample log message |
6 | 6 | $this->logger->info("Slim-Skeleton '/' route"); |
7 | 7 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | }); |
11 | 11 | |
12 | 12 | // Render Twig template in route |
13 | -$app->get('/theme/{name}', function ($request, $response, $args) { |
|
13 | +$app->get('/theme/{name}', function($request, $response, $args) { |
|
14 | 14 | // Erdiko setup (load configs) |
15 | 15 | // $erdiko = \erdiko\App; |
16 | 16 | // $erdiko->load('application'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | })->setName('theme'); |
34 | 34 | |
35 | 35 | // Render Twig template in route |
36 | -$app->any('/render/[{name}]', function ($request, $response, $args) { |
|
36 | +$app->any('/render/[{name}]', function($request, $response, $args) { |
|
37 | 37 | // Erdiko setup (load configs) |
38 | 38 | // $erdiko = \erdiko\App; |
39 | 39 | // $erdiko->load('application'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | // Monolog settings |
14 | 14 | 'logger' => [ |
15 | 15 | 'name' => 'slim-app', |
16 | - 'path' => dirname(__DIR__) . '/var/logs/app.log', |
|
16 | + 'path' => dirname(__DIR__).'/var/logs/app.log', |
|
17 | 17 | 'level' => \Monolog\Logger::DEBUG, |
18 | 18 | ], |
19 | 19 |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | $container = $app->getContainer(); |
4 | 4 | |
5 | 5 | // View renderer |
6 | -$container['renderer'] = function ($container) { |
|
6 | +$container['renderer'] = function($container) { |
|
7 | 7 | $settings = $container->get('settings')['renderer']; |
8 | 8 | return new Slim\Views\PhpRenderer($settings['template_path']); |
9 | 9 | }; |
10 | 10 | |
11 | 11 | // Monolog |
12 | -$container['logger'] = function ($container) { |
|
12 | +$container['logger'] = function($container) { |
|
13 | 13 | $settings = $container->get('settings')['logger']; |
14 | 14 | $logger = new Monolog\Logger($settings['name']); |
15 | 15 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | }; |
19 | 19 | |
20 | 20 | // Theme view (erdiko, twig) |
21 | -$container['theme'] = function ($container) { |
|
21 | +$container['theme'] = function($container) { |
|
22 | 22 | $settings = $container->get('settings')['theme']; |
23 | 23 | $view = new \Slim\Views\Twig($settings['templates'], [ |
24 | 24 | 'debug' => $settings['debug'], |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | // Instantiate and add Slim specific extension |
29 | 29 | $basePath = rtrim(str_ireplace('index.php', '', $container['request']->getUri()->getBasePath()), '/'); |
30 | 30 | $view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath)); |
31 | - if($settings['debug'] == true) |
|
31 | + if ($settings['debug'] == true) |
|
32 | 32 | $view->addExtension(new \Twig_Extension_Debug()); |
33 | 33 | |
34 | 34 | return $view; |
35 | 35 | }; |
36 | 36 | |
37 | 37 | // 404 Handler |
38 | -$container['notFoundHandler'] = function ($container) { |
|
39 | - return function ($request, $response) use ($container) { |
|
38 | +$container['notFoundHandler'] = function($container) { |
|
39 | + return function($request, $response) use ($container) { |
|
40 | 40 | $themeData = \erdiko\theme\Config::get(); |
41 | 41 | return $container['theme']->render($response->withStatus(404), '404.html', $themeData); |
42 | 42 | }; |
@@ -28,8 +28,9 @@ |
||
28 | 28 | // Instantiate and add Slim specific extension |
29 | 29 | $basePath = rtrim(str_ireplace('index.php', '', $container['request']->getUri()->getBasePath()), '/'); |
30 | 30 | $view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath)); |
31 | - if($settings['debug'] == true) |
|
32 | - $view->addExtension(new \Twig_Extension_Debug()); |
|
31 | + if($settings['debug'] == true) { |
|
32 | + $view->addExtension(new \Twig_Extension_Debug()); |
|
33 | + } |
|
33 | 34 | |
34 | 35 | return $view; |
35 | 36 | }; |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | $response = $this->runApp('GET', '/'); |
13 | 13 | |
14 | 14 | $this->assertEquals(200, $response->getStatusCode()); |
15 | - $this->assertContains('SlimFramework', (string)$response->getBody()); |
|
16 | - $this->assertNotContains('Hello', (string)$response->getBody()); |
|
15 | + $this->assertContains('SlimFramework', (string) $response->getBody()); |
|
16 | + $this->assertNotContains('Hello', (string) $response->getBody()); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $response = $this->runApp('GET', '/name'); |
25 | 25 | |
26 | 26 | $this->assertEquals(200, $response->getStatusCode()); |
27 | - $this->assertContains('Hello name!', (string)$response->getBody()); |
|
27 | + $this->assertContains('Hello name!', (string) $response->getBody()); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,6 +35,6 @@ discard block |
||
35 | 35 | $response = $this->runApp('POST', '/', ['test']); |
36 | 36 | |
37 | 37 | $this->assertEquals(405, $response->getStatusCode()); |
38 | - $this->assertContains('Method not allowed', (string)$response->getBody()); |
|
38 | + $this->assertContains('Method not allowed', (string) $response->getBody()); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -52,21 +52,21 @@ |
||
52 | 52 | $response = new Response(); |
53 | 53 | |
54 | 54 | // Use the application settings |
55 | - $settings = require __DIR__ . '/../../src/settings.php'; |
|
55 | + $settings = require __DIR__.'/../../src/settings.php'; |
|
56 | 56 | |
57 | 57 | // Instantiate the application |
58 | 58 | $app = new App($settings); |
59 | 59 | |
60 | 60 | // Set up dependencies |
61 | - require __DIR__ . '/../../src/dependencies.php'; |
|
61 | + require __DIR__.'/../../src/dependencies.php'; |
|
62 | 62 | |
63 | 63 | // Register middleware |
64 | 64 | if ($this->withMiddleware) { |
65 | - require __DIR__ . '/../../src/middleware.php'; |
|
65 | + require __DIR__.'/../../src/middleware.php'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Register routes |
69 | - require __DIR__ . '/../../src/routes.php'; |
|
69 | + require __DIR__.'/../../src/routes.php'; |
|
70 | 70 | |
71 | 71 | // Process the application |
72 | 72 | $response = $app->process($request, $response); |