@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | // Renderer settings |
9 | 9 | 'renderer' => [ |
10 | - 'template_path' => __DIR__.'/../templates/', |
|
10 | + 'template_path' => __DIR__ . '/../templates/', |
|
11 | 11 | ], |
12 | 12 | |
13 | 13 | // Monolog settings |
14 | 14 | 'logger' => [ |
15 | 15 | 'name' => 'slim-app', |
16 | - 'path' => __DIR__.'/../logs/app.log', |
|
16 | + 'path' => __DIR__ . '/../logs/app.log', |
|
17 | 17 | 'level' => \Monolog\Logger::DEBUG, |
18 | 18 | ], |
19 | 19 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Tasks Routes Groups. |
15 | 15 | */ |
16 | -$app->group('/tasks', function () use ($app) { |
|
16 | +$app->group('/tasks', function() use ($app) { |
|
17 | 17 | $app->get('', 'App\Controller\TasksController:getTasks'); |
18 | 18 | $app->get('/[{id}]', 'App\Controller\TasksController:getTask'); |
19 | 19 | $app->get('/search/[{query}]', 'App\Controller\TasksController:searchTasks'); |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Users Routes Groups. |
27 | 27 | */ |
28 | -$app->group('/users', function () use ($app) { |
|
29 | - $app->get('', function () { |
|
28 | +$app->group('/users', function() use ($app) { |
|
29 | + $app->get('', function() { |
|
30 | 30 | $users = new App\Controller\UsersController($this->db); |
31 | 31 | $result = $users->getUsers(); |
32 | 32 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
33 | 33 | }); |
34 | - $app->get('/[{id}]', function ($request, $response, $args) { |
|
34 | + $app->get('/[{id}]', function($request, $response, $args) { |
|
35 | 35 | $users = new App\Controller\UsersController($this->db); |
36 | 36 | $result = $users->getUser($args['id']); |
37 | 37 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
38 | 38 | }); |
39 | - $app->get('/search/[{query}]', function ($request, $response, $args) { |
|
39 | + $app->get('/search/[{query}]', function($request, $response, $args) { |
|
40 | 40 | $users = new App\Controller\UsersController($this->db); |
41 | 41 | $result = $users->searchUsers($args['query']); |
42 | 42 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
43 | 43 | }); |
44 | - $app->post('', function ($request) { |
|
44 | + $app->post('', function($request) { |
|
45 | 45 | $users = new App\Controller\UsersController($this->db); |
46 | 46 | $result = $users->createUser($request); |
47 | 47 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
48 | 48 | }); |
49 | - $app->put('/[{id}]', function ($request, $response, $args) { |
|
49 | + $app->put('/[{id}]', function($request, $response, $args) { |
|
50 | 50 | $users = new App\Controller\UsersController($this->db); |
51 | 51 | $result = $users->updateUser($request, $args['id']); |
52 | 52 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
53 | 53 | }); |
54 | - $app->delete('/[{id}]', function ($request, $response, $args) { |
|
54 | + $app->delete('/[{id}]', function($request, $response, $args) { |
|
55 | 55 | $users = new App\Controller\UsersController($this->db); |
56 | 56 | $result = $users->deleteUser($args['id']); |
57 | 57 | return $this->response->withJson($result, $result['code'], JSON_PRETTY_PRINT); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | $repository = new TasksRepository; |
83 | 83 | $query = $repository->searchTasksQuery(); |
84 | 84 | $statement = $this->database->prepare($query); |
85 | - $query = '%'.$tasksName.'%'; |
|
85 | + $query = '%' . $tasksName . '%'; |
|
86 | 86 | $statement->bindParam('query', $query); |
87 | 87 | $statement->execute(); |
88 | 88 | $tasks = $statement->fetchAll(); |
@@ -3,10 +3,10 @@ |
||
3 | 3 | $container = $app->getContainer(); |
4 | 4 | |
5 | 5 | // PDO database library |
6 | -$container['db'] = function ($c) { |
|
6 | +$container['db'] = function($c) { |
|
7 | 7 | $settings = $c->get('settings')['db']; |
8 | 8 | $pdo = new PDO( |
9 | - 'mysql:host='.$settings['host'].';dbname='.$settings['dbname'], |
|
9 | + 'mysql:host=' . $settings['host'] . ';dbname=' . $settings['dbname'], |
|
10 | 10 | $settings['user'], |
11 | 11 | $settings['pass'] |
12 | 12 | ); |