Completed
Push — master ( db8664...c5b64e )
by Florian
10s
created
src/Famoser/SyncApi/SyncApiApp.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,6 @@
 block discarded – undo
11 11
 
12 12
 use Famoser\SyncApi\Exceptions\ApiException;
13 13
 use Famoser\SyncApi\Exceptions\FrontendException;
14
-use Famoser\SyncApi\Middleware\LoggingMiddleware;
15 14
 use Famoser\SyncApi\Models\Communication\Response\Base\BaseResponse;
16 15
 use Famoser\SyncApi\Services\DatabaseService;
17 16
 use Famoser\SyncApi\Services\Interfaces\LoggingServiceInterface;
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     private function getWebAppRoutes()
100 100
     {
101 101
         $controllerNamespace = $this->controllerNamespace;
102
-        return function () use ($controllerNamespace) {
102
+        return function() use ($controllerNamespace) {
103 103
             $this->get('/', $controllerNamespace . 'PublicController:index')->setName('index');
104 104
             $this->get('/info', $controllerNamespace . 'PublicController:info')->setName('api_info');
105 105
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
             $this->group(
119 119
                 '/dashboard',
120
-                function () use ($controllerNamespace) {
120
+                function() use ($controllerNamespace) {
121 121
                     $this->get('/', $controllerNamespace . 'ApplicationController:index')
122 122
                         ->setName('application_index');
123 123
                     $this->get('/show/{id}', $controllerNamespace . 'ApplicationController:show')
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
     private function getApiRoutes()
152 152
     {
153 153
         $controllerNamespace = $this->controllerNamespace;
154
-        return function () use ($controllerNamespace) {
154
+        return function() use ($controllerNamespace) {
155 155
             $this->group(
156 156
                 '/auth',
157
-                function () use ($controllerNamespace) {
157
+                function() use ($controllerNamespace) {
158 158
                     $this->post('/use', $controllerNamespace . 'AuthorizationController:useCode');
159 159
                     $this->post('/generate', $controllerNamespace . 'AuthorizationController:generate');
160 160
                     $this->post('/sync', $controllerNamespace . 'AuthorizationController:sync');
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 
165 165
             $this->group(
166 166
                 '/users',
167
-                function () use ($controllerNamespace) {
167
+                function() use ($controllerNamespace) {
168 168
                     $this->post('/auth', $controllerNamespace . 'UserController:auth');
169 169
                 }
170 170
             );
171 171
 
172 172
             $this->group(
173 173
                 '/devices',
174
-                function () use ($controllerNamespace) {
174
+                function() use ($controllerNamespace) {
175 175
                     $this->post('/get', $controllerNamespace . 'DeviceController:get');
176 176
                     $this->post('/auth', $controllerNamespace . 'DeviceController:auth');
177 177
                     $this->post('/unauth', $controllerNamespace . 'DeviceController:unAuth');
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 
181 181
             $this->group(
182 182
                 '/collections',
183
-                function () use ($controllerNamespace) {
183
+                function() use ($controllerNamespace) {
184 184
                     $this->post('/sync', $controllerNamespace . 'CollectionController:sync');
185 185
                 }
186 186
             );
187 187
 
188 188
             $this->group(
189 189
                 '/entities',
190
-                function () use ($controllerNamespace) {
190
+                function() use ($controllerNamespace) {
191 191
                     $this->post('/sync', $controllerNamespace . 'EntityController:sync');
192 192
                     $this->post('/history/sync', $controllerNamespace . 'EntityController:historySync');
193 193
                 }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $this->addServices($container);
211 211
 
212 212
         //add view
213
-        $container['view'] = function (Container $container) {
213
+        $container['view'] = function(Container $container) {
214 214
             $view = new Twig(
215 215
                 $container->get(SyncApiApp::SETTINGS_KEY)['template_path'],
216 216
                 [
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
      */
270 270
     private function createNotFoundHandlerClosure(ContainerInterface $container, $apiError)
271 271
     {
272
-        return function () use ($container, $apiError) {
273
-            return function (ServerRequestInterface $request, ResponseInterface $response) use ($container, $apiError) {
272
+        return function() use ($container, $apiError) {
273
+            return function(ServerRequestInterface $request, ResponseInterface $response) use ($container, $apiError) {
274 274
 
275 275
                 /* @var LoggingServiceInterface $logger */
276
-                $logger =  $container[SyncApiApp::LOGGING_SERVICE_KEY];
276
+                $logger = $container[SyncApiApp::LOGGING_SERVICE_KEY];
277 277
                 $logger->log(
278
-                    "[".date("c")."]: not found / not allowed " . $request->getUri()
278
+                    "[" . date("c") . "]: not found / not allowed " . $request->getUri()
279 279
                 );
280 280
 
281 281
                 if ($this->isApiRequest($request)) {
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
      */
299 299
     private function createErrorHandlerClosure(ContainerInterface $cont)
300 300
     {
301
-        return function () use ($cont) {
302
-            return function (ServerRequestInterface $request, ResponseInterface $response, $error = null) use ($cont) {
301
+        return function() use ($cont) {
302
+            return function(ServerRequestInterface $request, ResponseInterface $response, $error = null) use ($cont) {
303 303
                 if ($error instanceof \Exception || $error instanceof \Throwable) {
304 304
                     $errorString = $error->getFile() . ' (' . $error->getLine() . ')\n' .
305 305
                         $error->getCode() . ': ' . $error->getMessage() . '\n' .
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
                 }
310 310
 
311 311
                 /* @var LoggingServiceInterface $logger */
312
-                $logger =  $cont[SyncApiApp::LOGGING_SERVICE_KEY];
312
+                $logger = $cont[SyncApiApp::LOGGING_SERVICE_KEY];
313 313
                 $logger->log(
314
-                    "[".date("c")."]: ".$errorString
314
+                    "[" . date("c") . "]: " . $errorString
315 315
                 );
316 316
 
317 317
                 //return json if api request
@@ -351,19 +351,19 @@  discard block
 block discarded – undo
351 351
      */
352 352
     private function addServices(Container $container)
353 353
     {
354
-        $container[SyncApiApp::LOGGING_SERVICE_KEY] = function (Container $container) {
354
+        $container[SyncApiApp::LOGGING_SERVICE_KEY] = function(Container $container) {
355 355
             return new LoggingService($container);
356 356
         };
357
-        $container[SyncApiApp::REQUEST_SERVICE_KEY] = function (Container $container) {
357
+        $container[SyncApiApp::REQUEST_SERVICE_KEY] = function(Container $container) {
358 358
             return new RequestService($container);
359 359
         };
360
-        $container[SyncApiApp::DATABASE_SERVICE_KEY] = function (Container $container) {
360
+        $container[SyncApiApp::DATABASE_SERVICE_KEY] = function(Container $container) {
361 361
             return new DatabaseService($container);
362 362
         };
363
-        $container[SyncApiApp::SESSION_SERVICE_KEY] = function (Container $container) {
363
+        $container[SyncApiApp::SESSION_SERVICE_KEY] = function(Container $container) {
364 364
             return new SessionService($container);
365 365
         };
366
-        $container[SyncApiApp::MAIL_SERVICE_KEY] = function (Container $container) {
366
+        $container[SyncApiApp::MAIL_SERVICE_KEY] = function(Container $container) {
367 367
             return new MailService($container);
368 368
         };
369 369
     }
Please login to merge, or discard this patch.