@@ -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,10 +3,10 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class Grid extends \erdiko\Controller |
| 5 | 5 | { |
| 6 | - public function __invoke($request, $response, $args) |
|
| 7 | - { |
|
| 6 | + public function __invoke($request, $response, $args) |
|
| 7 | + { |
|
| 8 | 8 | $this->container->logger->debug("/controller"); |
| 9 | - $view = 'pages/grid.html'; |
|
| 9 | + $view = 'pages/grid.html'; |
|
| 10 | 10 | |
| 11 | 11 | // Get erdiko config, this gets application.json and loads the theme specified |
| 12 | 12 | $config = \erdiko\theme\Config::get(); |
@@ -29,6 +29,6 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | $config['items'] = $items; |
| 31 | 31 | |
| 32 | - return $this->container->theme->render($response, $view, $config); |
|
| 33 | - } |
|
| 32 | + return $this->container->theme->render($response, $view, $config); |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -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); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function getTheme2($request, $response, $args) |
| 116 | 116 | { |
| 117 | - $theme = new \erdiko\theme\Engine( $this->container->get('settings')['theme'] ); |
|
| 117 | + $theme = new \erdiko\theme\Engine($this->container->get('settings')['theme']); |
|
| 118 | 118 | $theme->title = "Theme Engine Example"; |
| 119 | 119 | $theme->description = "This page is rendered with the erdiko theme engine. |
| 120 | 120 | It does not leverage the erdiko theme trait. |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | 'name' => "Item" |
| 161 | 161 | ]; |
| 162 | 162 | $items = array(); |
| 163 | - $max = (int)$args['param']; |
|
| 163 | + $max = (int) $args['param']; |
|
| 164 | 164 | $this->container->logger->debug("param: ".$max); |
| 165 | 165 | |
| 166 | - for($i = 0; $i < $max; $i++) { |
|
| 166 | + for ($i = 0; $i < $max; $i++) { |
|
| 167 | 167 | $item['name'] = "Item $i"; |
| 168 | 168 | $items[] = $item; |
| 169 | 169 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Application Routes |
| 3 | 3 | |
| 4 | -$app->get('/', function ($request, $response, $args) { |
|
| 4 | +$app->get('/', function($request, $response, $args) { |
|
| 5 | 5 | // Render index view |
| 6 | 6 | return $this->theme->render($response, 'slim.phtml', $args); |
| 7 | 7 | }); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | // ->setName('home'); |
| 12 | 12 | |
| 13 | 13 | // Render Twig template in route |
| 14 | -$app->any('/render/[{name}]', function ($request, $response, $args) { |
|
| 14 | +$app->any('/render/[{name}]', function($request, $response, $args) { |
|
| 15 | 15 | // Erdiko setup (load configs) |
| 16 | 16 | // $erdiko = \erdiko\App; |
| 17 | 17 | // $erdiko->load('application'); |
@@ -3,14 +3,14 @@ |
||
| 3 | 3 | |
| 4 | 4 | class Config extends \erdiko\Controller |
| 5 | 5 | { |
| 6 | - public function __invoke($request, $response, $args) |
|
| 7 | - { |
|
| 6 | + public function __invoke($request, $response, $args) |
|
| 7 | + { |
|
| 8 | 8 | $this->container->logger->debug("route: /config"); |
| 9 | - $view = 'pages/config.html'; |
|
| 9 | + $view = 'pages/config.html'; |
|
| 10 | 10 | |
| 11 | 11 | $config['theme'] = \erdiko\theme\Config::get($this->container->get('settings')['theme']); |
| 12 | 12 | $config['page']['title'] = "Dump Theme Config"; |
| 13 | 13 | |
| 14 | - return $this->container->theme->render($response, $view, $config); |
|
| 15 | - } |
|
| 14 | + return $this->container->theme->render($response, $view, $config); |
|
| 15 | + } |
|
| 16 | 16 | } |
@@ -101,22 +101,22 @@ |
||
| 101 | 101 | |
| 102 | 102 | public function getCreatedAt() |
| 103 | 103 | { |
| 104 | - return $this->created_at; |
|
| 104 | + return $this->created_at; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function setCreatedAt($created) |
| 108 | 108 | { |
| 109 | - $this->created_at = $created; |
|
| 109 | + $this->created_at = $created; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function getUpdatedAt() |
| 113 | 113 | { |
| 114 | - return $this->updated_at; |
|
| 114 | + return $this->updated_at; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function setUpdatedAt($updated) |
| 118 | 118 | { |
| 119 | - $this->updated_at = $updated; |
|
| 119 | + $this->updated_at = $updated; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -6,10 +6,10 @@ |
||
| 6 | 6 | // \erdiko\session\Session::set("start", true); |
| 7 | 7 | |
| 8 | 8 | // Set up dependencies |
| 9 | -require_once __DIR__ . '/bootstrap/dependencies.php'; |
|
| 9 | +require_once __DIR__.'/bootstrap/dependencies.php'; |
|
| 10 | 10 | |
| 11 | 11 | // Register middleware |
| 12 | -require_once __DIR__ . '/bootstrap/middleware.php'; |
|
| 12 | +require_once __DIR__.'/bootstrap/middleware.php'; |
|
| 13 | 13 | |
| 14 | 14 | // Register routes |
| 15 | -require_once __DIR__ . '/bootstrap/routes.php'; |
|
| 15 | +require_once __DIR__.'/bootstrap/routes.php'; |
|
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | $container = $app->getContainer(); |
| 4 | 4 | |
| 5 | 5 | // Register Session |
| 6 | -$container['session'] = function () { |
|
| 6 | +$container['session'] = function() { |
|
| 7 | 7 | return \erdiko\session\Session::getDriverDefault(); |
| 8 | 8 | }; |
| 9 | 9 | |
| 10 | 10 | // Monolog |
| 11 | -$container['logger'] = function ($container) { |
|
| 11 | +$container['logger'] = function($container) { |
|
| 12 | 12 | $settings = $container->get('settings')['logger']; |
| 13 | 13 | $logger = new Monolog\Logger($settings['name']); |
| 14 | 14 | $logger->pushProcessor(new Monolog\Processor\UidProcessor()); |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | }; |
| 18 | 18 | |
| 19 | 19 | // Register flash provider |
| 20 | -$container['flash'] = function ($container) { |
|
| 20 | +$container['flash'] = function($container) { |
|
| 21 | 21 | return new \Slim\Flash\Messages($container['session']); |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | // EntityManager provider |
| 25 | -$container['em'] = function ($container) { |
|
| 25 | +$container['em'] = function($container) { |
|
| 26 | 26 | return \erdiko\doctrine\EntityManager::getEntityManager($container->get('settings')['database']); |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | 29 | // Theme view (erdiko, twig) |
| 30 | -$container['theme'] = function ($container) { |
|
| 30 | +$container['theme'] = function($container) { |
|
| 31 | 31 | $settings = $container->get('settings')['theme']; |
| 32 | 32 | $view = new \Slim\Views\Twig($settings['templates'], [ |
| 33 | 33 | 'debug' => $settings['debug'], |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | new Slim\Flash\Messages($container['session']) |
| 45 | 45 | )); |
| 46 | 46 | |
| 47 | - if( $settings['debug'] ) |
|
| 47 | + if ($settings['debug']) |
|
| 48 | 48 | $view->addExtension(new \Twig_Extension_Debug()); |
| 49 | 49 | |
| 50 | 50 | return $view; |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | 53 | // 404 Handler |
| 54 | -$container['notFoundHandler'] = function ($container) { |
|
| 55 | - return function ($request, $response) use ($container) { |
|
| 54 | +$container['notFoundHandler'] = function($container) { |
|
| 55 | + return function($request, $response) use ($container) { |
|
| 56 | 56 | $themeData = \erdiko\theme\Config::get($container->get('settings')['theme']); |
| 57 | 57 | return $container['theme']->render($response->withStatus(404), '404.html', $themeData); |
| 58 | 58 | }; |
@@ -44,8 +44,9 @@ |
||
| 44 | 44 | new Slim\Flash\Messages($container['session']) |
| 45 | 45 | )); |
| 46 | 46 | |
| 47 | - if( $settings['debug'] ) |
|
| 48 | - $view->addExtension(new \Twig_Extension_Debug()); |
|
| 47 | + if( $settings['debug'] ) { |
|
| 48 | + $view->addExtension(new \Twig_Extension_Debug()); |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | return $view; |
| 51 | 52 | }; |