@@ -15,16 +15,12 @@ |
||
15 | 15 | |
16 | 16 | use Negotiation\Negotiator; |
17 | 17 | use Pimple\Container; |
18 | - |
|
19 | - |
|
20 | - |
|
21 | 18 | use Component\Firewall\Firewall; |
22 | 19 | use Component\Http\JsonResponse; |
23 | 20 | use Component\Http\RedirectResponse; |
24 | 21 | use Component\Http\Request; |
25 | 22 | use Component\Http\Response; |
26 | 23 | use Component\Http\Session; |
27 | - |
|
28 | 24 | use App\Controller\Api\UserController; |
29 | 25 | use App\Controller\DefaultController; |
30 | 26 | use App\Controller\PageController; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this['debug'] = false; |
48 | 48 | $this['app.cache.dir'] = __DIR__.'/../../var/cache'; |
49 | 49 | $this['app.views.dir'] = __DIR__.'/../../views'; |
50 | - $this['app.session'] = function () { |
|
50 | + $this['app.session'] = function() { |
|
51 | 51 | return new Session( |
52 | 52 | [ |
53 | 53 | 'cookie_lifetime' => 5 * 60, |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | ); |
56 | 56 | }; |
57 | 57 | $this['app.user'] = $this->factory( |
58 | - function ($app) { |
|
58 | + function($app) { |
|
59 | 59 | return $app['app.session']->getUser(); |
60 | 60 | } |
61 | 61 | ); |
62 | - $this['api.provider.user'] = function ($app) { |
|
62 | + $this['api.provider.user'] = function($app) { |
|
63 | 63 | return new HttpBasicUserProvider($app['app.repository.user']); |
64 | 64 | }; |
65 | 65 | $this['api.user'] = $this->factory( |
66 | - function ($app) { |
|
66 | + function($app) { |
|
67 | 67 | return $this['api.provider.user']->getUser($app['app.request']); |
68 | 68 | } |
69 | 69 | ); |
70 | - $this['twig.loader'] = function ($app) { |
|
70 | + $this['twig.loader'] = function($app) { |
|
71 | 71 | return new \Twig_Loader_Filesystem($app['app.views.dir']); |
72 | 72 | }; |
73 | - $this['twig'] = function ($app) { |
|
73 | + $this['twig'] = function($app) { |
|
74 | 74 | $twig = new \Twig_Environment( |
75 | 75 | $app['twig.loader'], [ |
76 | 76 | 'debug' => $app['debug'], |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | |
81 | 81 | return $twig; |
82 | 82 | }; |
83 | - $this['app.repository.user'] = function () { |
|
83 | + $this['app.repository.user'] = function() { |
|
84 | 84 | return new UserRepository(); |
85 | 85 | }; |
86 | - $this['app.controller.default'] = function ($app) { |
|
86 | + $this['app.controller.default'] = function($app) { |
|
87 | 87 | return new DefaultController($app); |
88 | 88 | }; |
89 | - $this['app.controller.security'] = function ($app) { |
|
89 | + $this['app.controller.security'] = function($app) { |
|
90 | 90 | return new SecurityController($app); |
91 | 91 | }; |
92 | - $this['app.controller.page'] = function ($app) { |
|
92 | + $this['app.controller.page'] = function($app) { |
|
93 | 93 | return new PageController($app); |
94 | 94 | }; |
95 | - $this['app.controller.api.user'] = function ($app) { |
|
95 | + $this['app.controller.api.user'] = function($app) { |
|
96 | 96 | return new UserController($app); |
97 | 97 | }; |
98 | - $this['api.response.negociator'] = function () { |
|
98 | + $this['api.response.negociator'] = function() { |
|
99 | 99 | return new ResponseHandler(new Negotiator()); |
100 | 100 | }; |
101 | - $this['app.firewall'] = function () { |
|
101 | + $this['app.firewall'] = function() { |
|
102 | 102 | $firewall = new Firewall(); |
103 | 103 | $firewall->addRoute([], '/page/1', 'ROLE_PAGE_1'); |
104 | 104 | $firewall->addRoute([], '/page/2', 'ROLE_PAGE_2'); |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | |
107 | 107 | return $firewall; |
108 | 108 | }; |
109 | - $this['api.firewall'] = function () { |
|
109 | + $this['api.firewall'] = function() { |
|
110 | 110 | $firewall = new Firewall(); |
111 | 111 | $firewall->addRoute('GET', '/api', 'ROLE_API_READ'); |
112 | 112 | |
113 | 113 | return $firewall; |
114 | 114 | }; |
115 | - $this['app.router'] = function ($app) { |
|
115 | + $this['app.router'] = function($app) { |
|
116 | 116 | return \FastRoute\simpleDispatcher( |
117 | - function (\FastRoute\RouteCollector $router) { |
|
117 | + function(\FastRoute\RouteCollector $router) { |
|
118 | 118 | $router->addRoute(['GET'], '/', ['default', 'index']); |
119 | 119 | $router->addRoute(['GET', 'POST'], '/login', ['security', 'index']); |
120 | 120 | $router->addRoute(['GET'], '/logout', ['security', 'logout']); |
@@ -14,9 +14,6 @@ |
||
14 | 14 | namespace App\Negociation\Handler; |
15 | 15 | |
16 | 16 | use Negotiation\Negotiator; |
17 | - |
|
18 | - |
|
19 | - |
|
20 | 17 | use Component\Http\JsonResponse; |
21 | 18 | use Component\Http\Request; |
22 | 19 | use Component\Http\Response; |