@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param Request $request |
54 | 54 | * @param Response $response |
55 | 55 | * |
56 | - * @return mixed |
|
56 | + * @return \Psr\Http\Message\ResponseInterface |
|
57 | 57 | * @throws JsonException |
58 | 58 | */ |
59 | 59 | public function getToken(Request $request, Response $response) |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param Request $request |
114 | 114 | * @param Response $response |
115 | 115 | * |
116 | - * @return mixed |
|
116 | + * @return \Psr\Http\Message\ResponseInterface |
|
117 | 117 | * @throws JsonException |
118 | 118 | */ |
119 | 119 | public function refreshToken(Request $request, Response $response) |
@@ -6,10 +6,8 @@ |
||
6 | 6 | use App\Model\User; |
7 | 7 | use App\Model\AccessToken; |
8 | 8 | use App\Model\RefreshToken; |
9 | - |
|
10 | 9 | use Slim\Http\Request; |
11 | 10 | use Slim\Http\Response; |
12 | - |
|
13 | 11 | use App\Common\JsonException; |
14 | 12 | |
15 | 13 | final class TokenController extends BaseController |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | // monolog settings |
9 | 9 | 'logger' => [ |
10 | 10 | 'name' => 'app', |
11 | - 'path' => __DIR__ . '/../log/app.log', |
|
11 | + 'path' => __DIR__.'/../log/app.log', |
|
12 | 12 | 'level' => Monolog\Logger::DEBUG, |
13 | 13 | ], |
14 | 14 | |
15 | - 'mailTemplate' => __DIR__ . '/../mail', |
|
15 | + 'mailTemplate' => __DIR__.'/../mail', |
|
16 | 16 | |
17 | 17 | // DB |
18 | - 'database' => require(__DIR__ . '/../config/db.php'), |
|
18 | + 'database' => require(__DIR__.'/../config/db.php'), |
|
19 | 19 | |
20 | 20 | // ACL |
21 | 21 | 'acl' => [ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * specified here so can be used in the code if needs be |
31 | 31 | * Example: ['user' => null] |
32 | 32 | */ |
33 | - 'resources' => [ ], |
|
33 | + 'resources' => [], |
|
34 | 34 | // where we specify the guarding! |
35 | 35 | 'guards' => [ |
36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * if included all resources default to deny unless specified. |
40 | 40 | * Example: ['user', ['admin']] |
41 | 41 | */ |
42 | - 'resources' => [ ], |
|
42 | + 'resources' => [], |
|
43 | 43 | /** |
44 | 44 | * list of literal routes for guarding. |
45 | 45 | * optional |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * ['route', ['roles'], ['methods',' methods1']] |
49 | 49 | */ |
50 | 50 | 'routes' => [ |
51 | - ['/api/token', ['guest'], ['post']], |
|
52 | - ['/api/user', ['user'], ['get']], |
|
51 | + ['/api/token', ['guest'], ['post']], |
|
52 | + ['/api/user', ['user'], ['get']], |
|
53 | 53 | ], |
54 | 54 | /** |
55 | 55 | * list of callables to resolve against |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | * ['callable', ['roles']] |
60 | 60 | */ |
61 | 61 | 'callables' => [ |
62 | - ['App\Controller\CrudController', ['user']], |
|
63 | - ['App\Controller\CrudController:actionIndex', ['user']], |
|
64 | - ['App\Controller\CrudController:actionGet', ['user']], |
|
62 | + ['App\Controller\CrudController', ['user']], |
|
63 | + ['App\Controller\CrudController:actionIndex', ['user']], |
|
64 | + ['App\Controller\CrudController:actionGet', ['user']], |
|
65 | 65 | ['App\Controller\CrudController:actionCreate', ['user']], |
66 | 66 | ['App\Controller\CrudController:actionUpdate', ['user']], |
67 | 67 | ['App\Controller\CrudController:actionDelete', ['user']], |
68 | 68 | |
69 | - ['App\Controller\UserController:actionIndex', ['user']], |
|
70 | - ['App\Controller\UserController:actionGet', ['user']], |
|
69 | + ['App\Controller\UserController:actionIndex', ['user']], |
|
70 | + ['App\Controller\UserController:actionGet', ['user']], |
|
71 | 71 | ['App\Controller\UserController:actionCreate', ['admin']], |
72 | 72 | ['App\Controller\UserController:actionUpdate', ['admin']], |
73 | 73 | ['App\Controller\UserController:actionDelete', ['admin']], |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | ], |
92 | 92 | |
93 | 93 | 'translate' => [ |
94 | - 'path' => __DIR__ . '/../lang', |
|
94 | + 'path' => __DIR__.'/../lang', |
|
95 | 95 | 'locale' => 'ru', |
96 | 96 | ], |
97 | 97 | |
98 | - 'params' => require(__DIR__ . '/../config/params.php'), |
|
98 | + 'params' => require(__DIR__.'/../config/params.php'), |
|
99 | 99 | ], |
100 | 100 | ]; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | $config = $container['settings']['acl']; |
18 | 18 | |
19 | - $container['acl'] = function (Container $c) use ($config) { |
|
19 | + $container['acl'] = function(Container $c) use ($config) { |
|
20 | 20 | $acl = new Acl($config); |
21 | 21 | |
22 | 22 | return $acl; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $config = $container['settings']; |
17 | 17 | |
18 | - $container['mailer'] = function (Container $c) use ($config) { |
|
18 | + $container['mailer'] = function(Container $c) use ($config) { |
|
19 | 19 | $transport = \Swift_MailTransport::newInstance(); |
20 | 20 | $mailer = \Swift_Mailer::newInstance($transport); |
21 | 21 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | $config = $container['settings']['logger']; |
20 | 20 | |
21 | - $container['logger'] = function (Container $c) use ($config) { |
|
21 | + $container['logger'] = function(Container $c) use ($config) { |
|
22 | 22 | $logger = new Logger($config['name']); |
23 | 23 | $logger->pushProcessor(new UidProcessor()); |
24 | 24 | $logger->pushHandler(new StreamHandler($config['path'], $config['level'])); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function register(Container $container) |
16 | 16 | { |
17 | - $container['errorHandler'] = function (Container $c) { |
|
17 | + $container['errorHandler'] = function(Container $c) { |
|
18 | 18 | return function($request, $response, $exception) use ($c) { |
19 | 19 | $details = (defined('DEBUG_MODE') && DEBUG_MODE == 1) ? $exception->getMessage() : 'Internal server error'; |
20 | 20 | $e = new JsonException(null, 500, 'Internal server error', $details); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | }; |
24 | 24 | }; |
25 | 25 | |
26 | - $container['notAllowedHandler'] = function (Container $c) { |
|
26 | + $container['notAllowedHandler'] = function(Container $c) { |
|
27 | 27 | return function($request, $response, $methods) use ($c) { |
28 | 28 | throw new JsonException(null, 405, 'Method Not Allowed', 'Method must be one of: '.implode(', ', $methods)); |
29 | 29 | }; |
30 | 30 | }; |
31 | 31 | |
32 | - $container['notFoundHandler'] = function (Container $c) { |
|
32 | + $container['notFoundHandler'] = function(Container $c) { |
|
33 | 33 | return function() use ($c) { |
34 | 34 | throw new JsonException(null, 404, 'Not found', 'Entity not found'); |
35 | 35 | }; |
@@ -17,13 +17,13 @@ |
||
17 | 17 | { |
18 | 18 | $config = $container['settings']; |
19 | 19 | |
20 | - $container['renderer'] = function (Container $c) use ($config) { |
|
20 | + $container['renderer'] = function(Container $c) use ($config) { |
|
21 | 21 | $renderer = new Renderer($config); |
22 | 22 | |
23 | 23 | return $renderer; |
24 | 24 | }; |
25 | 25 | |
26 | - $container['mailRenderer'] = function (Container $c) use ($config) { |
|
26 | + $container['mailRenderer'] = function(Container $c) use ($config) { |
|
27 | 27 | $renderer = new MailRenderer($config['mailTemplate']); |
28 | 28 | |
29 | 29 | return $renderer; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $config = $container['settings']; |
22 | 22 | |
23 | 23 | // translation |
24 | - $container['translator'] = function (Container $c) use ($config) { |
|
24 | + $container['translator'] = function(Container $c) use ($config) { |
|
25 | 25 | $translation_file_loader = new FileLoader(new Filesystem, $config['translate']['path']); |
26 | 26 | $translator = new Translator($translation_file_loader, $config['translate']['locale']); |
27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | }; |
30 | 30 | |
31 | 31 | // validation |
32 | - $container['validation'] = function (Container $c) use ($config) { |
|
32 | + $container['validation'] = function(Container $c) use ($config) { |
|
33 | 33 | $validation = new Factory($c->get('translator')); |
34 | 34 | $presence = new DatabasePresenceVerifier($c->get('databaseManager')); |
35 | 35 | $validation->setPresenceVerifier($presence); |
@@ -14,9 +14,9 @@ |
||
14 | 14 | */ |
15 | 15 | public function register(Container $container) |
16 | 16 | { |
17 | - $config = $container['settings']; |
|
17 | + $config = $container['settings']; |
|
18 | 18 | |
19 | - $container['encoder'] = function (Container $c) use ($config) { |
|
19 | + $container['encoder'] = function(Container $c) use ($config) { |
|
20 | 20 | $encoder = new JsonApiEncoder($config); |
21 | 21 | |
22 | 22 | return $encoder; |