@@ -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 | }; |
@@ -1,1 +1,1 @@ |
||
1 | -<?php header( 'Location: index.html' ) ; |
|
1 | +<?php header('Location: index.html'); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | $app->get('/status', 'App\Controller\DefaultController:getStatus'); |
7 | 7 | $app->post('/login', \App\Controller\User\Login::class); |
8 | 8 | |
9 | -$app->group('/api/v1', function () use ($app) { |
|
10 | - $app->group('/tasks', function () use ($app) { |
|
9 | +$app->group('/api/v1', function() use ($app) { |
|
10 | + $app->group('/tasks', function() use ($app) { |
|
11 | 11 | $app->get('', \App\Controller\Task\GetAll::class); |
12 | 12 | $app->get('/[{id}]', \App\Controller\Task\GetOne::class); |
13 | 13 | $app->get('/search/[{query}]', \App\Controller\Task\Search::class); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $app->put('/[{id}]', \App\Controller\Task\Update::class); |
16 | 16 | $app->delete('/[{id}]', \App\Controller\Task\Delete::class); |
17 | 17 | })->add(new App\Middleware\AuthMiddleware()); |
18 | - $app->group('/users', function () use ($app) { |
|
18 | + $app->group('/users', function() use ($app) { |
|
19 | 19 | $app->get('', \App\Controller\User\GetAll::class)->add(new App\Middleware\AuthMiddleware()); |
20 | 20 | $app->get('/[{id}]', \App\Controller\User\GetOne::class)->add(new App\Middleware\AuthMiddleware()); |
21 | 21 | $app->get('/search/[{query}]', \App\Controller\User\Search::class)->add(new App\Middleware\AuthMiddleware()); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $app->put('/[{id}]', \App\Controller\User\Update::class)->add(new App\Middleware\AuthMiddleware()); |
24 | 24 | $app->delete('/[{id}]', \App\Controller\User\Delete::class)->add(new App\Middleware\AuthMiddleware()); |
25 | 25 | }); |
26 | - $app->group('/notes', function () use ($app) { |
|
26 | + $app->group('/notes', function() use ($app) { |
|
27 | 27 | $app->get('', \App\Controller\Note\GetAll::class); |
28 | 28 | $app->get('/[{id}]', \App\Controller\Note\GetOne::class); |
29 | 29 | $app->get('/search/[{query}]', \App\Controller\Note\Search::class); |
@@ -15,34 +15,34 @@ |
||
15 | 15 | |
16 | 16 | $container = $app->getContainer(); |
17 | 17 | |
18 | -$container['user_service'] = function (ContainerInterface $container): UserService { |
|
18 | +$container['user_service'] = function(ContainerInterface $container): UserService { |
|
19 | 19 | return new UserService($container->get('user_repository'), $container->get('redis_service')); |
20 | 20 | }; |
21 | 21 | |
22 | -$container['task_service'] = function (ContainerInterface $container): TaskService { |
|
22 | +$container['task_service'] = function(ContainerInterface $container): TaskService { |
|
23 | 23 | return new TaskService($container->get('task_repository'), $container->get('redis_service')); |
24 | 24 | }; |
25 | 25 | |
26 | -$container['create_note_service'] = function (ContainerInterface $container): Create { |
|
26 | +$container['create_note_service'] = function(ContainerInterface $container): Create { |
|
27 | 27 | return new Create($container->get('note_repository'), $container->get('redis_service')); |
28 | 28 | }; |
29 | 29 | |
30 | -$container['delete_note_service'] = function (ContainerInterface $container): Delete { |
|
30 | +$container['delete_note_service'] = function(ContainerInterface $container): Delete { |
|
31 | 31 | return new Delete($container->get('note_repository'), $container->get('redis_service')); |
32 | 32 | }; |
33 | 33 | |
34 | -$container['get_all_note_service'] = function (ContainerInterface $container): GetAll { |
|
34 | +$container['get_all_note_service'] = function(ContainerInterface $container): GetAll { |
|
35 | 35 | return new GetAll($container->get('note_repository'), $container->get('redis_service')); |
36 | 36 | }; |
37 | 37 | |
38 | -$container['get_one_note_service'] = function (ContainerInterface $container): GetOne { |
|
38 | +$container['get_one_note_service'] = function(ContainerInterface $container): GetOne { |
|
39 | 39 | return new GetOne($container->get('note_repository'), $container->get('redis_service')); |
40 | 40 | }; |
41 | 41 | |
42 | -$container['search_note_service'] = function (ContainerInterface $container): Search { |
|
42 | +$container['search_note_service'] = function(ContainerInterface $container): Search { |
|
43 | 43 | return new Search($container->get('note_repository'), $container->get('redis_service')); |
44 | 44 | }; |
45 | 45 | |
46 | -$container['update_note_service'] = function (ContainerInterface $container): Update { |
|
46 | +$container['update_note_service'] = function(ContainerInterface $container): Update { |
|
47 | 47 | return new Update($container->get('note_repository'), $container->get('redis_service')); |
48 | 48 | }; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $container = $app->getContainer(); |
10 | 10 | |
11 | -$container['db'] = function (ContainerInterface $c): PDO { |
|
11 | +$container['db'] = function(ContainerInterface $c): PDO { |
|
12 | 12 | $db = $c->get('settings')['db']; |
13 | 13 | $database = sprintf('mysql:host=%s;dbname=%s', $db['hostname'], $db['database']); |
14 | 14 | $pdo = new PDO($database, $db['username'], $db['password']); |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | return $pdo; |
20 | 20 | }; |
21 | 21 | |
22 | -$container['errorHandler'] = function (): ApiError { |
|
22 | +$container['errorHandler'] = function(): ApiError { |
|
23 | 23 | return new ApiError(); |
24 | 24 | }; |
25 | 25 | |
26 | -$container['redis_service'] = function (): RedisService { |
|
26 | +$container['redis_service'] = function(): RedisService { |
|
27 | 27 | return new RedisService(new \Predis\Client(getenv('REDIS_URL'))); |
28 | 28 | }; |