Completed
Push — master ( 45d3c5...af8085 )
by
unknown
07:27
created
lib/Controller/StatusController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * @return DataResponse
44 44
      */
45 45
     public function getStatus() {
46
-        return $this->handleNotFound(function () {
46
+        return $this->handleNotFound(function() {
47 47
             return $this->service->getStatus();
48 48
         });
49 49
     }
Please login to merge, or discard this patch.
lib/Service/JobService.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@
 block discarded – undo
171 171
      * Delete an ocr job for a given id and userId.
172 172
      * 
173 173
      * @param
174
-     *            $jobId
174
+     integer            $jobId
175 175
      * @param string $userId            
176 176
      * @return OcrJob
177 177
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 foreach ($fileInfo as $fInfo) {
158 158
                     // Check Shared
159 159
                     $shared = $this->fileService->checkSharedWithInitiator($fInfo);
160
-                    if($shared && $replace) {
160
+                    if ($shared && $replace) {
161 161
                         throw new NotFoundException($this->l10n->t('Cannot replace shared files.'));
162 162
                     }
163 163
                     $target = $this->fileService->buildTarget($fInfo, $shared, $replace);
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
             $this->logger->debug('Check if files were processed by ocr and if so, put them to the right dirs.', ['app' => OcrConstants::APP_NAME]);
277 277
             $processed = $this->jobMapper->findAllProcessed($this->userId);
278 278
             foreach ($processed as $job) {
279
-                if ($this->fileUtil->fileExists($this->tempM->getTempBaseDir().'/'.$job->getTempFile().'.pdf')) {
279
+                if ($this->fileUtil->fileExists($this->tempM->getTempBaseDir() . '/' . $job->getTempFile() . '.pdf')) {
280 280
                     // Save the tmp file with newname
281 281
                     $this->pullResult($job);
282 282
                     $this->jobMapper->delete($job);
283
-                    $this->fileUtil->execRemove($this->tempM->getTempBaseDir().'/'.$job->getTempFile().'.pdf');
283
+                    $this->fileUtil->execRemove($this->tempM->getTempBaseDir() . '/' . $job->getTempFile() . '.pdf');
284 284
                 } else {
285 285
                     $job->setStatus(OcrConstants::STATUS_FAILED);
286 286
                     $job->setErrorLog('Temp file does not exist.');
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             $failed = $this->jobMapper->findAllFailed($this->userId);
305 305
             foreach ($failed as $job) {
306 306
                 // clean the tempfile
307
-                $this->fileUtil->execRemove($this->tempM->getTempBaseDir().'/'.$job->getTempFile().'.pdf');
307
+                $this->fileUtil->execRemove($this->tempM->getTempBaseDir() . '/' . $job->getTempFile() . '.pdf');
308 308
                 // set error displayed
309 309
                 $job->setErrorDisplayed(true);
310 310
                 $this->jobMapper->update($job);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         if ($job->getReplace()) {
330 330
             $this->view->unlink(str_replace($this->userId . '/files', '', $job->getSource()));
331 331
         }
332
-        $result = $this->view->file_put_contents($job->getTarget(), $this->fileUtil->getFileContents($this->tempM->getTempBaseDir().'/'.$job->getTempFile().'.pdf'));
332
+        $result = $this->view->file_put_contents($job->getTarget(), $this->fileUtil->getFileContents($this->tempM->getTempBaseDir() . '/' . $job->getTempFile() . '.pdf'));
333 333
         if (!$result) {
334 334
             throw new NotFoundException($this->l10n->t('OCR could not put processed file to the right target folder. If you selected the replace option, you can restore the file by using the trash bin.'));
335 335
         }
Please login to merge, or discard this patch.
lib/Controller/AdminSettingsController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getLanguages() {
54 54
         return $this->handleNotFound(
55
-                function () {
55
+                function() {
56 56
                     return [
57 57
                             'languages' => $this->appConfig->getAppValue(OcrConstants::LANGUAGES_CONFIG_KEY)
58 58
                     ];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function evaluateRedisSettings() {
68 68
         return $this->handleNotFound(
69
-                function () {
69
+                function() {
70 70
                     return [
71 71
                             'set' => $this->appConfig->evaluateRedisSettings()
72 72
                     ];
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function setLanguages($languages) {
83 83
         return $this->handleNotFound(
84
-                function () use ($languages) {
84
+                function() use ($languages) {
85 85
                     $this->appConfig->setAppValue(OcrConstants::LANGUAGES_CONFIG_KEY, $languages);
86 86
                     return $this->l10n->t('Saved');
87 87
                 });
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function setRedis($redisHost, $redisPort, $redisDb, $redisPassword) {
100 100
         return $this->handleNotFound(
101
-                function () use ($redisHost, $redisPort, $redisDb, $redisPassword) {
101
+                function() use ($redisHost, $redisPort, $redisDb, $redisPassword) {
102 102
                     $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_HOST, $redisHost);
103 103
                     $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_PORT, $redisPort);
104 104
                     $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_DB, $redisDb);
Please login to merge, or discard this patch.
lib/Util/RedisUtil.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             throw new NotFoundException($this->l10n->t('Cannot connect to Redis.'));
83 83
         }
84 84
         $password = $this->config->getAppValue($this->appName, 'redisPassword', '');
85
-        if($password !== '') {
85
+        if ($password !== '') {
86 86
             $authenticated = $redis->auth($password);
87 87
         }
88 88
         if ($password !== '' && !$authenticated) {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $redis->setOption(\Redis::OPT_PREFIX, OcrConstants::REDIS_KEY_PREFIX);
97 97
         return $redis;
98 98
         } catch (\RedisException $e) {
99
-            if($e->getMessage() === 'Failed to AUTH connection') {
99
+            if ($e->getMessage() === 'Failed to AUTH connection') {
100 100
                 throw new NotFoundException($this->l10n->t('Redis authentication error.'));
101 101
             }
102 102
         }
Please login to merge, or discard this patch.
lib/Controller/JobController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function process($languages, $files, $replace) {
66 66
         return $this->handleNotFound(
67
-                function () use ($languages, $files, $replace) {
67
+                function() use ($languages, $files, $replace) {
68 68
                     return $this->service->process($languages, $files, $replace);
69 69
                 });
70 70
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getAllJobs() {
78 78
         return $this->handleNotFound(
79
-                function () {
79
+                function() {
80 80
                     return $this->service->getAllJobsForUser($this->userId);
81 81
                 });
82 82
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function deleteJob($id) {
91 91
         return $this->handleNotFound(
92
-                function () use ($id) {
92
+                function() use ($id) {
93 93
                     return $this->service->deleteJob($id, $this->userId);
94 94
                 });
95 95
     }
Please login to merge, or discard this patch.
lib/Service/FileService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
         if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
190 190
             // PDFs:
191 191
             if ($replace) {
192
-                if($filePath === '/') {
192
+                if ($filePath === '/') {
193 193
                     $filePath = '';
194 194
                 }
195
-                return $filePath . '/'. $fileName . '.pdf';
195
+                return $filePath . '/' . $fileName . '.pdf';
196 196
             } else {
197 197
                 return $this->fileUtil->buildNotExistingFilename($filePath, $fileName . '.pdf');
198 198
             }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
232 232
             // PDFs:
233 233
             if ($replace) {
234
-                if($filePath === '/') {
234
+                if ($filePath === '/') {
235 235
                     $filePath = '';
236 236
                 }
237 237
                 return $filePath . '/' . $fileName . '.pdf';
Please login to merge, or discard this patch.
lib/Service/RedisService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
                 throw new NotFoundException($this->l10n->t('Could not add files to the Redis OCR processing queue.'));
108 108
             }
109 109
         } catch (Exception $e) {
110
-            $this->fileUtil->execRemove($this->tempM->getTempBaseDir().'/'.$job->getTempFile().'.pdf');
110
+            $this->fileUtil->execRemove($this->tempM->getTempBaseDir() . '/' . $job->getTempFile() . '.pdf');
111 111
             $job->setStatus(OcrConstants::STATUS_FAILED);
112 112
             $job->setErrorLog($e->getMessage());
113 113
             $this->mapper->update($job);
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
          */
53 53
         $eventDispatcher = \OC::$server->getEventDispatcher();
54 54
         $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', 
55
-                function () {
55
+                function() {
56 56
                     script(OcrConstants::APP_NAME, 'dist/ocrapp');
57 57
                     style(OcrConstants::APP_NAME, 'ocrstyle');
58 58
                     // if not loaded before - load select2 for multi select languages
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
          * Register core services
64 64
          */
65 65
         $container->registerService('CurrentUID', 
66
-                function (IContainer $c) {
66
+                function(IContainer $c) {
67 67
                     /** @var \OC\Server $server */
68 68
                     $server = $c->query('ServerContainer');
69 69
                     $user = $server->getUserSession()
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
                     return ($user) ? $user->getUID() : '';
72 72
                 });
73 73
         // Allow automatic DI for the View, until they migrated to Nodes API
74
-        $container->registerService(View::class, function () {
74
+        $container->registerService(View::class, function() {
75 75
             return new View('');
76 76
         }, false);
77 77
         /**
78 78
          * Register the PHPUtil
79 79
          */
80 80
         $container->registerService('PHPUtil', 
81
-                function (IContainer $c) {
81
+                function(IContainer $c) {
82 82
                     /** @var \OC\Server $server */
83 83
                     $server = $c->query('ServerContainer');
84 84
                     return new PHPUtil($server->getL10N(OcrConstants::APP_NAME));
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
          * Register the RedisUtil
88 88
          */
89 89
         $container->registerService('RedisUtil', 
90
-                function (IContainer $c) {
90
+                function(IContainer $c) {
91 91
                     /** @var \OC\Server $server */
92 92
                     $server = $c->query('ServerContainer');
93 93
                     return new RedisUtil($server->getL10N(OcrConstants::APP_NAME), $server->getLogger(), $server->getConfig());
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
          * Register the FileUtil
97 97
          */
98 98
         $container->registerService('FileUtil', 
99
-                function (IContainer $c) {
99
+                function(IContainer $c) {
100 100
                     return new FileUtil();
101 101
                 });
102 102
         /**
103 103
          * Register the Ocr Job mapper
104 104
          */
105 105
         $container->registerService('OcrJobMapper', 
106
-                function (IContainer $c) {
106
+                function(IContainer $c) {
107 107
                     /** @var \OC\Server $server */
108 108
                     $server = $c->query('ServerContainer');
109 109
                     return new OcrJobMapper($server->getDatabaseConnection());
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
          * Register the File mapper
113 113
          */
114 114
         $container->registerService('FileMapper', 
115
-                function (IContainer $c) {
115
+                function(IContainer $c) {
116 116
                     /** @var \OC\Server $server */
117 117
                     $server = $c->query('ServerContainer');
118 118
                     return new FileMapper($server->getDatabaseConnection());
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
          * Register the Share mapper
122 122
          */
123 123
         $container->registerService('ShareMapper', 
124
-                function (IContainer $c) {
124
+                function(IContainer $c) {
125 125
                     /** @var \OC\Server $server */
126 126
                     $server = $c->query('ServerContainer');
127 127
                     return new ShareMapper($server->getDatabaseConnection());
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
          * Register the App Config Service
131 131
          */
132 132
         $container->registerService('AppConfigService', 
133
-                function (IAppContainer $c) {
133
+                function(IAppContainer $c) {
134 134
                     /** @var \OC\Server $server */
135 135
                     $server = $c->query('ServerContainer');
136 136
                     return new AppConfigService($server->getConfig(), $server->getL10N(OcrConstants::APP_NAME), $c->query('RedisUtil'), 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
          * Register the Job Service
141 141
          */
142 142
         $container->registerService('FileService', 
143
-                function (IAppContainer $c) {
143
+                function(IAppContainer $c) {
144 144
                     /** @var \OC\Server $server */
145 145
                     $server = $c->query('ServerContainer');
146 146
                     return new FileService($server->getL10N(OcrConstants::APP_NAME), $server->getLogger(), $c->query('CurrentUID'), 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
          * Register the Redis Service
151 151
          */
152 152
         $container->registerService('RedisService', 
153
-                function (IAppContainer $c) {
153
+                function(IAppContainer $c) {
154 154
                     /** @var \OC\Server $server */
155 155
                     $server = $c->query('ServerContainer');
156 156
                     return new RedisService($c->query('OcrJobMapper'), $c->query('FileUtil'), $c->query('RedisUtil'), 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
          * Register the Job Service
161 161
          */
162 162
         $container->registerService('JobService', 
163
-                function (IAppContainer $c) {
163
+                function(IAppContainer $c) {
164 164
                     /** @var \OC\Server $server */
165 165
                     $server = $c->query('ServerContainer');
166 166
                     return new JobService($server->getL10N(OcrConstants::APP_NAME), $server->getLogger(), $c->query('CurrentUID'), 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
          * Register the Status Service
173 173
          */
174 174
         $container->registerService('StatusService', 
175
-                function (IAppContainer $c) {
175
+                function(IAppContainer $c) {
176 176
                     /** @var \OC\Server $server */
177 177
                     $server = $c->query('ServerContainer');
178 178
                     return new StatusService($server->getL10N(OcrConstants::APP_NAME), $server->getLogger(), $c->query('CurrentUID'), 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
          * Controller
183 183
          */
184 184
         $container->registerService('StatusController', 
185
-                function (IAppContainer $c) {
185
+                function(IAppContainer $c) {
186 186
                     /** @var \OC\Server $server */
187 187
                     $server = $c->query('ServerContainer');
188 188
                     return new StatusController($c->getAppName(), $server->getRequest(), $c->query('StatusService'));
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
          * Controller
192 192
          */
193 193
         $container->registerService('JobController', 
194
-                function (IAppContainer $c) {
194
+                function(IAppContainer $c) {
195 195
                     /** @var \OC\Server $server */
196 196
                     $server = $c->query('ServerContainer');
197 197
                     return new JobController($c->getAppName(), $server->getRequest(), $c->query('JobService'), 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
          * Controller
202 202
          */
203 203
         $container->registerService('UserHooks', 
204
-                function (IAppContainer $c) {
204
+                function(IAppContainer $c) {
205 205
                     /** @var \OC\Server $server */
206 206
                     $server = $c->query('ServerContainer');
207 207
                     return new UserHooks($c->query('ServerContainer')
Please login to merge, or discard this patch.
lib/Hooks/UserHooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      * Registers the user hooks.
52 52
      */
53 53
     public function register() {
54
-        $postDelete = function ($user) {
54
+        $postDelete = function($user) {
55 55
             $this->logger->debug('Deleting all jobs for user "{user}" after user deletion (Hook).', [
56 56
                     'user' => $user->getUID(),
57 57
                     'app' => OcrConstants::APP_NAME
Please login to merge, or discard this patch.