@@ -7,14 +7,14 @@ |
||
7 | 7 | |
8 | 8 | $container = $app->getContainer(); |
9 | 9 | |
10 | -$container['user_repository'] = function (ContainerInterface $container): UserRepository { |
|
10 | +$container['user_repository'] = function(ContainerInterface $container): UserRepository { |
|
11 | 11 | return new UserRepository($container->get('db')); |
12 | 12 | }; |
13 | 13 | |
14 | -$container['task_repository'] = function (ContainerInterface $container): TaskRepository { |
|
14 | +$container['task_repository'] = function(ContainerInterface $container): TaskRepository { |
|
15 | 15 | return new TaskRepository($container->get('db')); |
16 | 16 | }; |
17 | 17 | |
18 | -$container['note_repository'] = function (ContainerInterface $container): NoteRepository { |
|
18 | +$container['note_repository'] = function(ContainerInterface $container): NoteRepository { |
|
19 | 19 | return new NoteRepository($container->get('db')); |
20 | 20 | }; |
@@ -7,14 +7,14 @@ |
||
7 | 7 | |
8 | 8 | $container = $app->getContainer(); |
9 | 9 | |
10 | -$container['user_service'] = function (ContainerInterface $container): UserService { |
|
10 | +$container['user_service'] = function(ContainerInterface $container): UserService { |
|
11 | 11 | return new UserService($container->get('user_repository'), $container->get('redis_service')); |
12 | 12 | }; |
13 | 13 | |
14 | -$container['task_service'] = function (ContainerInterface $container): TaskService { |
|
14 | +$container['task_service'] = function(ContainerInterface $container): TaskService { |
|
15 | 15 | return new TaskService($container->get('task_repository'), $container->get('redis_service')); |
16 | 16 | }; |
17 | 17 | |
18 | -$container['note_service'] = function (ContainerInterface $container): NoteService { |
|
18 | +$container['note_service'] = function(ContainerInterface $container): NoteService { |
|
19 | 19 | return new NoteService($container->get('note_repository'), $container->get('redis_service')); |
20 | 20 | }; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | $container = $app->getContainer(); |
8 | 8 | |
9 | -$container['db'] = function (ContainerInterface $c): PDO { |
|
9 | +$container['db'] = function(ContainerInterface $c): PDO { |
|
10 | 10 | $db = $c->get('settings')['db']; |
11 | 11 | $database = sprintf('mysql:host=%s;dbname=%s', $db['hostname'], $db['database']); |
12 | 12 | $pdo = new PDO($database, $db['username'], $db['password']); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | return $pdo; |
18 | 18 | }; |
19 | 19 | |
20 | -$container['errorHandler'] = function (): ApiError { |
|
20 | +$container['errorHandler'] = function(): ApiError { |
|
21 | 21 | return new ApiError; |
22 | 22 | }; |
23 | 23 | |
24 | -$container['redis_service'] = function (): RedisService { |
|
24 | +$container['redis_service'] = function(): RedisService { |
|
25 | 25 | return new RedisService(new \Predis\Client(getenv('REDIS_URL'))); |
26 | 26 | }; |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | $app->get('/status', 'App\Controller\DefaultController:getStatus'); |
5 | 5 | $app->post('/login', 'App\Controller\User\LoginUser'); |
6 | 6 | |
7 | -$app->group('/api/v1', function () use ($app) { |
|
8 | - $app->group('/tasks', function () use ($app) { |
|
7 | +$app->group('/api/v1', function() use ($app) { |
|
8 | + $app->group('/tasks', function() use ($app) { |
|
9 | 9 | $app->get('', 'App\Controller\Task\GetAllTasks'); |
10 | 10 | $app->get('/[{id}]', 'App\Controller\Task\GetOneTask'); |
11 | 11 | $app->get('/search/[{query}]', 'App\Controller\Task\SearchTasks'); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $app->put('/[{id}]', 'App\Controller\Task\UpdateTask'); |
14 | 14 | $app->delete('/[{id}]', 'App\Controller\Task\DeleteTask'); |
15 | 15 | })->add(new App\Middleware\AuthMiddleware($app)); |
16 | - $app->group('/users', function () use ($app) { |
|
16 | + $app->group('/users', function() use ($app) { |
|
17 | 17 | $app->get('', 'App\Controller\User\GetAllUsers')->add(new App\Middleware\AuthMiddleware($app)); |
18 | 18 | $app->get('/[{id}]', 'App\Controller\User\GetOneUser')->add(new App\Middleware\AuthMiddleware($app)); |
19 | 19 | $app->get('/search/[{query}]', 'App\Controller\User\SearchUsers')->add(new App\Middleware\AuthMiddleware($app)); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $app->put('/[{id}]', 'App\Controller\User\UpdateUser')->add(new App\Middleware\AuthMiddleware($app)); |
22 | 22 | $app->delete('/[{id}]', 'App\Controller\User\DeleteUser')->add(new App\Middleware\AuthMiddleware($app)); |
23 | 23 | }); |
24 | - $app->group('/notes', function () use ($app) { |
|
24 | + $app->group('/notes', function() use ($app) { |
|
25 | 25 | $app->get('', 'App\Controller\Note\GetAllNotes'); |
26 | 26 | $app->get('/[{id}]', 'App\Controller\Note\GetOneNote'); |
27 | 27 | $app->get('/search/[{query}]', 'App\Controller\Note\SearchNotes'); |
@@ -1,1 +1,1 @@ |
||
1 | -<?php header( 'Location: index.html' ) ; |
|
1 | +<?php header('Location: index.html'); |