@@ -204,7 +204,7 @@ |
||
| 204 | 204 | /** |
| 205 | 205 | * @param BaseSyncEntity $syncEntity |
| 206 | 206 | * @param $contentType |
| 207 | - * @return ContentVersion|null |
|
| 207 | + * @return ContentVersion |
|
| 208 | 208 | */ |
| 209 | 209 | private function getActiveVersion(BaseSyncEntity $syncEntity, $contentType) |
| 210 | 210 | { |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | * @param null|string $where |
| 98 | 98 | * @param null|array $parameters |
| 99 | 99 | * @param null|string $orderBy |
| 100 | - * @return null|Application|ApplicationSetting|AuthorizationCode|Collection|ContentVersion|Device|Entity| |
|
| 100 | + * @return BaseEntity |
|
| 101 | 101 | * FrontendUser|User|UserCollection |
| 102 | 102 | */ |
| 103 | 103 | public function getSingleFromDatabase(BaseEntity $entity, $where = null, $parameters = null, $orderBy = null); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | /** |
| 64 | 64 | * checks if the value to be assigned to a setting is valid |
| 65 | 65 | * |
| 66 | - * @param $key |
|
| 66 | + * @param string $key |
|
| 67 | 67 | * @param $val |
| 68 | 68 | * @return bool |
| 69 | 69 | */ |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | { |
| 35 | 35 | //check if mail settings are defined |
| 36 | 36 | $mailSettings = isset($this->getSettingsArray()['mail']) ? |
| 37 | - $this->getSettingsArray()['mail'] : |
|
| 38 | - ['type' => 'mail']; |
|
| 37 | + $this->getSettingsArray()['mail'] : ['type' => 'mail']; |
|
| 39 | 38 | |
| 40 | 39 | if ($mailSettings['type'] == 'smtp') { |
| 41 | 40 | $transport = Swift_SmtpTransport::newInstance($mailSettings['url'], $mailSettings['port']) |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * SettingsRepository constructor. |
| 34 | 34 | * |
| 35 | 35 | * @param DatabaseServiceInterface $helper |
| 36 | - * @param $applicationId |
|
| 36 | + * @param string $applicationId |
|
| 37 | 37 | */ |
| 38 | 38 | public function __construct(DatabaseServiceInterface $helper, $applicationId) |
| 39 | 39 | { |
@@ -99,7 +99,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |