@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | */ |
40 | 40 | public function getName() { |
41 | - return $this->l->t ( 'OCR' ); |
|
41 | + return $this->l->t('OCR'); |
|
42 | 42 | } |
43 | 43 | /** |
44 | 44 | * |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * $UserId |
48 | 48 | */ |
49 | 49 | public function __construct($AppName, IRequest $request, JobService $service, $UserId) { |
50 | - parent::__construct ( $AppName, $request ); |
|
50 | + parent::__construct($AppName, $request); |
|
51 | 51 | $this->userId = $UserId; |
52 | 52 | $this->service = $service; |
53 | 53 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @return DataResponse |
63 | 63 | */ |
64 | 64 | public function process($languages, $files) { |
65 | - return $this->handleNotFound ( function () use ($languages, $files) { |
|
66 | - return $this->service->process ( $languages, $files ); |
|
65 | + return $this->handleNotFound(function() use ($languages, $files) { |
|
66 | + return $this->service->process($languages, $files); |
|
67 | 67 | } ); |
68 | 68 | } |
69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @return \OCP\AppFramework\Http\DataResponse |
74 | 74 | */ |
75 | 75 | public function getAllJobs() { |
76 | - return $this->handleNotFound ( function () { |
|
77 | - return $this->service->getAllJobsForUser ( $this->userId ); |
|
76 | + return $this->handleNotFound(function() { |
|
77 | + return $this->service->getAllJobsForUser($this->userId); |
|
78 | 78 | } ); |
79 | 79 | } |
80 | 80 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return \OCP\AppFramework\Http\DataResponse |
86 | 86 | */ |
87 | 87 | public function deleteJob($id) { |
88 | - return $this->handleNotFound ( function () use ($id) { |
|
89 | - return $this->service->deleteJob ( $id, $this->userId ); |
|
88 | + return $this->handleNotFound(function() use ($id) { |
|
89 | + return $this->service->deleteJob($id, $this->userId); |
|
90 | 90 | } ); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -18,15 +18,15 @@ |
||
18 | 18 | * it's instantiated in there |
19 | 19 | */ |
20 | 20 | return [ |
21 | - 'routes' => [ |
|
21 | + 'routes' => [ |
|
22 | 22 | ['name' => 'Job#process', 'url' => '/', 'verb' => 'POST'], |
23 | - ['name' => 'Job#deleteJob', 'url' => '/', 'verb' => 'DELETE'], |
|
24 | - ['name' => 'Job#getAllJobs', 'url' => '/', 'verb' => 'GET'], |
|
23 | + ['name' => 'Job#deleteJob', 'url' => '/', 'verb' => 'DELETE'], |
|
24 | + ['name' => 'Job#getAllJobs', 'url' => '/', 'verb' => 'GET'], |
|
25 | 25 | ['name' => 'Status#getStatus', 'url' => '/status', 'verb' => 'GET'], |
26 | - // settings |
|
27 | - ['name' => 'AdminSettings#setLanguages', 'url' => '/admin/languages', 'verb' => 'POST'], |
|
28 | - ['name' => 'AdminSettings#setRedis', 'url' => '/admin/redis', 'verb' => 'POST'], |
|
29 | - ['name' => 'AdminSettings#getLanguages', 'url' => '/languages', 'verb' => 'GET'], |
|
30 | - ['name' => 'AdminSettings#evaluateRedisSettings', 'url' => '/redis', 'verb' => 'GET'] |
|
31 | - ] |
|
26 | + // settings |
|
27 | + ['name' => 'AdminSettings#setLanguages', 'url' => '/admin/languages', 'verb' => 'POST'], |
|
28 | + ['name' => 'AdminSettings#setRedis', 'url' => '/admin/redis', 'verb' => 'POST'], |
|
29 | + ['name' => 'AdminSettings#getLanguages', 'url' => '/languages', 'verb' => 'GET'], |
|
30 | + ['name' => 'AdminSettings#evaluateRedisSettings', 'url' => '/redis', 'verb' => 'GET'] |
|
31 | + ] |
|
32 | 32 | ]; |
33 | 33 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param string $userId |
41 | 41 | */ |
42 | 42 | public function __construct($appName, IRequest $request, IL10N $l10n, AppConfigService $appConfig, $userId) { |
43 | - parent::__construct ( $appName, $request ); |
|
43 | + parent::__construct($appName, $request); |
|
44 | 44 | $this->l10n = $l10n; |
45 | 45 | $this->appConfig = $appConfig; |
46 | 46 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @return DataResponse |
52 | 52 | */ |
53 | 53 | public function getLanguages() { |
54 | - return $this->handleNotFound ( function () { |
|
55 | - return [ 'languages' => $this->appConfig->getAppValue ( OcrConstants::LANGUAGES_CONFIG_KEY )]; |
|
54 | + return $this->handleNotFound(function() { |
|
55 | + return ['languages' => $this->appConfig->getAppValue(OcrConstants::LANGUAGES_CONFIG_KEY)]; |
|
56 | 56 | } ); |
57 | 57 | } |
58 | 58 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @return DataResponse |
63 | 63 | */ |
64 | 64 | public function evaluateRedisSettings() { |
65 | - return $this->handleNotFound ( function () { |
|
66 | - return [ 'set' => $this->appConfig->evaluateRedisSettings ()]; |
|
65 | + return $this->handleNotFound(function() { |
|
66 | + return ['set' => $this->appConfig->evaluateRedisSettings()]; |
|
67 | 67 | } ); |
68 | 68 | } |
69 | 69 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | * @return DataResponse |
75 | 75 | */ |
76 | 76 | public function setLanguages($languages) { |
77 | - return $this->handleNotFound ( function () use ($languages) { |
|
77 | + return $this->handleNotFound(function() use ($languages) { |
|
78 | 78 | if ($languages !== null) { |
79 | - $this->appConfig->setAppValue ( OcrConstants::LANGUAGES_CONFIG_KEY, $languages ); |
|
80 | - return $this->l10n->t ( 'Saved' ); |
|
79 | + $this->appConfig->setAppValue(OcrConstants::LANGUAGES_CONFIG_KEY, $languages); |
|
80 | + return $this->l10n->t('Saved'); |
|
81 | 81 | } else { |
82 | - throw new NotFoundException ( $this->l10n->t ( 'The languages are not specified in the correct format.' ) ); |
|
82 | + throw new NotFoundException($this->l10n->t('The languages are not specified in the correct format.')); |
|
83 | 83 | } |
84 | 84 | } ); |
85 | 85 | } |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * @return DataResponse |
94 | 94 | */ |
95 | 95 | public function setRedis($redisHost, $redisPort, $redisDb) { |
96 | - return $this->handleNotFound ( function () use ($redisHost, $redisPort, $redisDb) { |
|
96 | + return $this->handleNotFound(function() use ($redisHost, $redisPort, $redisDb) { |
|
97 | 97 | if ($redisHost !== null && $redisPort !== null && $redisDb !== null) { |
98 | - $this->appConfig->setAppValue ( OcrConstants::REDIS_CONFIG_KEY_HOST, $redisHost ); |
|
99 | - $this->appConfig->setAppValue ( OcrConstants::REDIS_CONFIG_KEY_PORT, $redisPort ); |
|
100 | - $this->appConfig->setAppValue ( OcrConstants::REDIS_CONFIG_KEY_DB, $redisDb ); |
|
101 | - return $this->l10n->t ( 'Saved' ); |
|
98 | + $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_HOST, $redisHost); |
|
99 | + $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_PORT, $redisPort); |
|
100 | + $this->appConfig->setAppValue(OcrConstants::REDIS_CONFIG_KEY_DB, $redisDb); |
|
101 | + return $this->l10n->t('Saved'); |
|
102 | 102 | } else { |
103 | - throw new NotFoundException ( $this->l10n->t ( 'The Redis settings do not have the right format.' ) ); |
|
103 | + throw new NotFoundException($this->l10n->t('The Redis settings do not have the right format.')); |
|
104 | 104 | } |
105 | 105 | } ); |
106 | 106 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return string |
53 | 53 | */ |
54 | 54 | public function getAppValue($key) { |
55 | - return $this->config->getAppValue ( $this->appName, $key ); |
|
55 | + return $this->config->getAppValue($this->appName, $key); |
|
56 | 56 | } |
57 | 57 | /** |
58 | 58 | * Evaluate if all redis related settings are set. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function evaluateRedisSettings() { |
63 | 63 | |
64 | - if ($this->config->getAppValue ( $this->appName, OcrConstants::REDIS_CONFIG_KEY_HOST ) !== '' && $this->config->getAppValue ( $this->appName, OcrConstants::REDIS_CONFIG_KEY_PORT ) !== '' && $this->config->getAppValue ( $this->appName, OcrConstants::REDIS_CONFIG_KEY_DB ) !== '') { |
|
64 | + if ($this->config->getAppValue($this->appName, OcrConstants::REDIS_CONFIG_KEY_HOST) !== '' && $this->config->getAppValue($this->appName, OcrConstants::REDIS_CONFIG_KEY_PORT) !== '' && $this->config->getAppValue($this->appName, OcrConstants::REDIS_CONFIG_KEY_DB) !== '') { |
|
65 | 65 | return true; |
66 | 66 | } else { |
67 | 67 | return false; |
@@ -76,27 +76,27 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setAppValue($key, $value) { |
78 | 78 | if ($key === OcrConstants::LANGUAGES_CONFIG_KEY) { |
79 | - if (! preg_match ( '/^(([a-z]{3,4}|[a-z]{3,4}\-[a-z]{3,4});)*([a-z]{3,4}|[a-z]{3,4}\-[a-z]{3,4})$/', $value )) { |
|
80 | - throw new NotFoundException ( $this->l10n->t ( 'The languages are not specified in the correct format.' ) ); |
|
79 | + if (!preg_match('/^(([a-z]{3,4}|[a-z]{3,4}\-[a-z]{3,4});)*([a-z]{3,4}|[a-z]{3,4}\-[a-z]{3,4})$/', $value)) { |
|
80 | + throw new NotFoundException($this->l10n->t('The languages are not specified in the correct format.')); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | if ($key === OcrConstants::REDIS_CONFIG_KEY_HOST) { |
84 | - if (! preg_match ( '/(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$)/', $value )) { |
|
85 | - throw new NotFoundException ( $this->l10n->t ( 'The redis host is not specified in the correct format.' ) ); |
|
84 | + if (!preg_match('/(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$)/', $value)) { |
|
85 | + throw new NotFoundException($this->l10n->t('The redis host is not specified in the correct format.')); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if ($key === OcrConstants::REDIS_CONFIG_KEY_PORT) { |
89 | - $value = intval ( $value ); |
|
90 | - if (! ($value > 0 && $value < 65535)) { |
|
91 | - throw new NotFoundException ( $this->l10n->t ( 'The redis port number is not specified in the correct format.' ) ); |
|
89 | + $value = intval($value); |
|
90 | + if (!($value > 0 && $value < 65535)) { |
|
91 | + throw new NotFoundException($this->l10n->t('The redis port number is not specified in the correct format.')); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | if ($key === OcrConstants::REDIS_CONFIG_KEY_DB) { |
95 | - $value = intval ( $value ); |
|
96 | - if (! ($value >= 0)) { |
|
97 | - throw new NotFoundException ( $this->l10n->t ( 'The redis db is not specified in the correct format.' ) ); |
|
95 | + $value = intval($value); |
|
96 | + if (!($value >= 0)) { |
|
97 | + throw new NotFoundException($this->l10n->t('The redis db is not specified in the correct format.')); |
|
98 | 98 | } |
99 | 99 | } |
100 | - return $this->config->setAppValue ( $this->appName, $key, $value ); |
|
100 | + return $this->config->setAppValue($this->appName, $key, $value); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | \ No newline at end of file |
@@ -99,7 +99,7 @@ |
||
99 | 99 | * @param string $originalFilename |
100 | 100 | * @param string $errorLog |
101 | 101 | */ |
102 | - public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null, $originalFilename = null, $errorLog= null) { |
|
102 | + public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null, $originalFilename = null, $errorLog = null) { |
|
103 | 103 | $this->setStatus($status); |
104 | 104 | $this->setSource($source); |
105 | 105 | $this->setTarget($target); |
@@ -32,12 +32,12 @@ |
||
32 | 32 | * @return TemplateResponse |
33 | 33 | */ |
34 | 34 | public function getForm() { |
35 | - return new TemplateResponse( 'ocr', 'settings-admin', [ |
|
36 | - OcrConstants::LANGUAGES_CONFIG_KEY => $this->config->getAppValue ( 'ocr', OcrConstants::LANGUAGES_CONFIG_KEY), |
|
37 | - OcrConstants::REDIS_CONFIG_KEY_HOST => $this->config->getAppValue ( 'ocr', OcrConstants::REDIS_CONFIG_KEY_HOST), |
|
35 | + return new TemplateResponse('ocr', 'settings-admin', [ |
|
36 | + OcrConstants::LANGUAGES_CONFIG_KEY => $this->config->getAppValue('ocr', OcrConstants::LANGUAGES_CONFIG_KEY), |
|
37 | + OcrConstants::REDIS_CONFIG_KEY_HOST => $this->config->getAppValue('ocr', OcrConstants::REDIS_CONFIG_KEY_HOST), |
|
38 | 38 | OcrConstants::REDIS_CONFIG_KEY_PORT => $this->config->getAppValue('ocr', OcrConstants::REDIS_CONFIG_KEY_PORT), |
39 | 39 | OcrConstants::REDIS_CONFIG_KEY_DB => $this->config->getAppValue('ocr', OcrConstants::REDIS_CONFIG_KEY_DB) |
40 | - ], 'blank' ); |
|
40 | + ], 'blank'); |
|
41 | 41 | } |
42 | 42 | /** |
43 | 43 | * |
@@ -40,139 +40,139 @@ discard block |
||
40 | 40 | * @param array $urlParams |
41 | 41 | */ |
42 | 42 | public function __construct(array $urlParams = array()) { |
43 | - parent::__construct ( 'ocr', $urlParams ); |
|
44 | - $container = $this->getContainer (); |
|
43 | + parent::__construct('ocr', $urlParams); |
|
44 | + $container = $this->getContainer(); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Add the js and style if OCA\Files app is loaded |
48 | 48 | */ |
49 | - $eventDispatcher = \OC::$server->getEventDispatcher (); |
|
50 | - $eventDispatcher->addListener ( 'OCA\Files::loadAdditionalScripts', function () { |
|
51 | - script ( 'ocr', 'dist/ocrapp' ); |
|
52 | - style ( 'ocr', 'ocrstyle' ); |
|
49 | + $eventDispatcher = \OC::$server->getEventDispatcher(); |
|
50 | + $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() { |
|
51 | + script('ocr', 'dist/ocrapp'); |
|
52 | + style('ocr', 'ocrstyle'); |
|
53 | 53 | // if not loaded before - load select2 for multi select languages |
54 | - vendor_script ( 'select2/select2' ); |
|
55 | - vendor_style ( 'select2/select2' ); |
|
54 | + vendor_script('select2/select2'); |
|
55 | + vendor_style('select2/select2'); |
|
56 | 56 | } ); |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Register core services |
60 | 60 | */ |
61 | - $container->registerService ( 'CurrentUID', function (IContainer $c) { |
|
61 | + $container->registerService('CurrentUID', function(IContainer $c) { |
|
62 | 62 | /** @var \OC\Server $server */ |
63 | - $server = $c->query ( 'ServerContainer' ); |
|
64 | - $user = $server->getUserSession ()->getUser (); |
|
65 | - return ($user) ? $user->getUID () : ''; |
|
63 | + $server = $c->query('ServerContainer'); |
|
64 | + $user = $server->getUserSession()->getUser(); |
|
65 | + return ($user) ? $user->getUID() : ''; |
|
66 | 66 | } ); |
67 | 67 | |
68 | 68 | // Allow automatic DI for the View, until they migrated to Nodes API |
69 | - $container->registerService ( View::class, function () { |
|
70 | - return new View ( '' ); |
|
71 | - }, false ); |
|
69 | + $container->registerService(View::class, function() { |
|
70 | + return new View(''); |
|
71 | + }, false); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Register the PHPUtil |
75 | 75 | */ |
76 | - $container->registerService ( 'PHPUtil', function (IContainer $c) { |
|
76 | + $container->registerService('PHPUtil', function(IContainer $c) { |
|
77 | 77 | /** @var \OC\Server $server */ |
78 | - $server = $c->query ( 'ServerContainer' ); |
|
79 | - return new PHPUtil ( $server->getL10N ( 'ocr' ), $server->getLogger () ); |
|
78 | + $server = $c->query('ServerContainer'); |
|
79 | + return new PHPUtil($server->getL10N('ocr'), $server->getLogger()); |
|
80 | 80 | } ); |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Register the Ocr Job mapper |
84 | 84 | */ |
85 | - $container->registerService ( 'OcrJobMapper', function (IContainer $c) { |
|
85 | + $container->registerService('OcrJobMapper', function(IContainer $c) { |
|
86 | 86 | /** @var \OC\Server $server */ |
87 | - $server = $c->query ( 'ServerContainer' ); |
|
88 | - return new OcrJobMapper ( $server->getDatabaseConnection () ); |
|
87 | + $server = $c->query('ServerContainer'); |
|
88 | + return new OcrJobMapper($server->getDatabaseConnection()); |
|
89 | 89 | } ); |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Register the File mapper |
93 | 93 | */ |
94 | - $container->registerService ( 'FileMapper', function (IContainer $c) { |
|
94 | + $container->registerService('FileMapper', function(IContainer $c) { |
|
95 | 95 | /** @var \OC\Server $server */ |
96 | - $server = $c->query ( 'ServerContainer' ); |
|
97 | - return new FileMapper ( $server->getDatabaseConnection () ); |
|
96 | + $server = $c->query('ServerContainer'); |
|
97 | + return new FileMapper($server->getDatabaseConnection()); |
|
98 | 98 | } ); |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Register the Share mapper |
102 | 102 | */ |
103 | - $container->registerService ( 'ShareMapper', function (IContainer $c) { |
|
103 | + $container->registerService('ShareMapper', function(IContainer $c) { |
|
104 | 104 | /** @var \OC\Server $server */ |
105 | - $server = $c->query ( 'ServerContainer' ); |
|
106 | - return new ShareMapper ( $server->getDatabaseConnection () ); |
|
105 | + $server = $c->query('ServerContainer'); |
|
106 | + return new ShareMapper($server->getDatabaseConnection()); |
|
107 | 107 | } ); |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Register the App Config Service |
111 | 111 | */ |
112 | - $container->registerService ( 'AppConfigService', function (IAppContainer $c) { |
|
112 | + $container->registerService('AppConfigService', function(IAppContainer $c) { |
|
113 | 113 | /** @var \OC\Server $server */ |
114 | - $server = $c->query ( 'ServerContainer' ); |
|
115 | - return new AppConfigService ( $server->getConfig (), $server->getL10N ( 'ocr' ) ); |
|
114 | + $server = $c->query('ServerContainer'); |
|
115 | + return new AppConfigService($server->getConfig(), $server->getL10N('ocr')); |
|
116 | 116 | } ); |
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Register the Job Service |
120 | 120 | */ |
121 | - $container->registerService ( 'FileService', function (IAppContainer $c) { |
|
121 | + $container->registerService('FileService', function(IAppContainer $c) { |
|
122 | 122 | /** @var \OC\Server $server */ |
123 | - $server = $c->query ( 'ServerContainer' ); |
|
124 | - return new FileService ( $server->getL10N ( 'ocr' ), $server->getLogger (), $c->query ( 'CurrentUID' ), $c->query ( 'FileMapper' ), $c->query ( 'ShareMapper' ) ); |
|
123 | + $server = $c->query('ServerContainer'); |
|
124 | + return new FileService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), $c->query('FileMapper'), $c->query('ShareMapper')); |
|
125 | 125 | } ); |
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Register the Redis Service |
129 | 129 | */ |
130 | - $container->registerService ( 'RedisService', function (IAppContainer $c) { |
|
130 | + $container->registerService('RedisService', function(IAppContainer $c) { |
|
131 | 131 | /** @var \OC\Server $server */ |
132 | - $server = $c->query ( 'ServerContainer' ); |
|
133 | - return new RedisService ( $c->query ( 'OcrJobMapper' ), $c->query ( 'FileService' ), $server->getConfig (), $server->getL10N ( 'ocr' ), $server->getLogger () ); |
|
132 | + $server = $c->query('ServerContainer'); |
|
133 | + return new RedisService($c->query('OcrJobMapper'), $c->query('FileService'), $server->getConfig(), $server->getL10N('ocr'), $server->getLogger()); |
|
134 | 134 | } ); |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Register the Job Service |
138 | 138 | */ |
139 | - $container->registerService ( 'JobService', function (IAppContainer $c) { |
|
139 | + $container->registerService('JobService', function(IAppContainer $c) { |
|
140 | 140 | /** @var \OC\Server $server */ |
141 | - $server = $c->query ( 'ServerContainer' ); |
|
142 | - return new JobService ( $server->getL10N ( 'ocr' ), $server->getLogger (), $c->query ( 'CurrentUID' ), new View ( '/' . $c->query ( 'CurrentUID' ) . '/files' ), $server->getTempManager (), $c->query ( 'RedisService' ), $c->query ( 'OcrJobMapper' ), $c->query ( 'FileService' ), $c->query ( 'AppConfigService' ), $c->query ( 'PHPUtil' ) ); |
|
141 | + $server = $c->query('ServerContainer'); |
|
142 | + return new JobService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), new View('/' . $c->query('CurrentUID') . '/files'), $server->getTempManager(), $c->query('RedisService'), $c->query('OcrJobMapper'), $c->query('FileService'), $c->query('AppConfigService'), $c->query('PHPUtil')); |
|
143 | 143 | } ); |
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Register the Status Service |
147 | 147 | */ |
148 | - $container->registerService ( 'StatusService', function (IAppContainer $c) { |
|
148 | + $container->registerService('StatusService', function(IAppContainer $c) { |
|
149 | 149 | /** @var \OC\Server $server */ |
150 | - $server = $c->query ( 'ServerContainer' ); |
|
151 | - return new StatusService ( $server->getL10N ( 'ocr' ), $server->getLogger (), $c->query ( 'CurrentUID' ), $c->query ( 'OcrJobMapper' ), $c->query ( 'JobService' ) ); |
|
150 | + $server = $c->query('ServerContainer'); |
|
151 | + return new StatusService($server->getL10N('ocr'), $server->getLogger(), $c->query('CurrentUID'), $c->query('OcrJobMapper'), $c->query('JobService')); |
|
152 | 152 | } ); |
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Controller |
156 | 156 | */ |
157 | - $container->registerService ( 'StatusController', function (IAppContainer $c) { |
|
157 | + $container->registerService('StatusController', function(IAppContainer $c) { |
|
158 | 158 | /** @var \OC\Server $server */ |
159 | - $server = $c->query ( 'ServerContainer' ); |
|
160 | - return new StatusController ( $c->getAppName (), $server->getRequest (), $c->query ( 'StatusService' ) ); |
|
159 | + $server = $c->query('ServerContainer'); |
|
160 | + return new StatusController($c->getAppName(), $server->getRequest(), $c->query('StatusService')); |
|
161 | 161 | } ); |
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Controller |
165 | 165 | */ |
166 | - $container->registerService ( 'JobController', function (IAppContainer $c) { |
|
166 | + $container->registerService('JobController', function(IAppContainer $c) { |
|
167 | 167 | /** @var \OC\Server $server */ |
168 | - $server = $c->query ( 'ServerContainer' ); |
|
169 | - return new JobController ( $c->getAppName (), $server->getRequest (), $c->query ( 'JobService' ), $c->query ( 'CurrentUID' ) ); |
|
168 | + $server = $c->query('ServerContainer'); |
|
169 | + return new JobController($c->getAppName(), $server->getRequest(), $c->query('JobService'), $c->query('CurrentUID')); |
|
170 | 170 | } ); |
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Controller |
174 | 174 | */ |
175 | - $container->registerAlias ( 'PersonalSettingsController', PersonalSettingsController::class ); |
|
175 | + $container->registerAlias('PersonalSettingsController', PersonalSettingsController::class); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,6 +180,6 @@ discard block |
||
180 | 180 | * @codeCoverageIgnore |
181 | 181 | */ |
182 | 182 | public function registerPersonal() { |
183 | - \OCP\App::registerPersonal ( $this->getContainer ()->getAppName (), 'personal' ); |
|
183 | + \OCP\App::registerPersonal($this->getContainer()->getAppName(), 'personal'); |
|
184 | 184 | } |
185 | 185 | } |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @return string |
51 | 51 | */ |
52 | 52 | public function tempnamWrapper($dir, $prefix) { |
53 | - $tempFile = tempnam ( $dir, $prefix ); |
|
54 | - if($tempFile === false){ |
|
55 | - throw new NotFoundException($this->l10n->t ( 'Temp file cannot be created.' )); |
|
53 | + $tempFile = tempnam($dir, $prefix); |
|
54 | + if ($tempFile === false) { |
|
55 | + throw new NotFoundException($this->l10n->t('Temp file cannot be created.')); |
|
56 | 56 | } else { |
57 | 57 | return $tempFile; |
58 | 58 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * @return boolean |
69 | 69 | */ |
70 | 70 | public function unlinkWrapper($fileName) { |
71 | - if(unlink ( $fileName )) { |
|
71 | + if (unlink($fileName)) { |
|
72 | 72 | return true; |
73 | 73 | } else { |
74 | - throw new NotFoundException($this->l10n->t ( 'Cannot delete temporary file during temp file creation for tesseract.' )); |
|
74 | + throw new NotFoundException($this->l10n->t('Cannot delete temporary file during temp file creation for tesseract.')); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * @return boolean |
86 | 86 | */ |
87 | 87 | public function touchWrapper($fileName) { |
88 | - if(touch ( $fileName )) { |
|
88 | + if (touch($fileName)) { |
|
89 | 89 | return true; |
90 | 90 | } else { |
91 | - throw new NotFoundException($this->l10n->t ( 'Cannot create temporary file for tesseract.' )); |
|
91 | + throw new NotFoundException($this->l10n->t('Cannot create temporary file for tesseract.')); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @return boolean |
104 | 104 | */ |
105 | 105 | public function chmodWrapper($fileName, $mode) { |
106 | - if(chmod ( $fileName, $mode )) { |
|
106 | + if (chmod($fileName, $mode)) { |
|
107 | 107 | return true; |
108 | 108 | } else { |
109 | - throw new NotFoundException($this->l10n->t ( 'Cannot set permissions to temporary file for tesseract.' )); |
|
109 | + throw new NotFoundException($this->l10n->t('Cannot set permissions to temporary file for tesseract.')); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | \ No newline at end of file |