Completed
Pull Request — master (#93)
by Janis
13:41
created
lib/Settings/Section.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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
 	 *
Please login to merge, or discard this patch.
lib/Controller/JobController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
lib/Controller/AdminSettingsController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
lib/Service/AppConfigService.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
lib/Db/OcrJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
lib/Settings/Admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
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
 	 *
Please login to merge, or discard this patch.
lib/AppInfo/Application.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -40,139 +40,139 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/Util/PHPUtil.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
lib/Service/FileService.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return boolean|null
70 70
 	 */
71 71
 	public function checkSharedWithInitiator($fileInfo) {
72
-		$owner = str_replace ( 'home::', '', $fileInfo->getStoragename () );
72
+		$owner = str_replace('home::', '', $fileInfo->getStoragename());
73 73
 		if ($this->userId === $owner) {
74 74
 			// user is owner (no shared file)
75 75
 			return false;
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function buildTarget($fileInfo, $shared) {
90 90
 		if ($shared) {
91
-			$target = $this->buildTargetForShared ( $fileInfo );
91
+			$target = $this->buildTargetForShared($fileInfo);
92 92
 		} else {
93
-			$target = $this->buildTargetNotForShared ( $fileInfo );
93
+			$target = $this->buildTargetNotForShared($fileInfo);
94 94
 		}
95 95
 		return $target;
96 96
 	}
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @return string
104 104
 	 */
105 105
 	public function buildSource($fileInfo, $shared) {
106
-		$source = $fileInfo->getPath ();
106
+		$source = $fileInfo->getPath();
107 107
 		if ($shared) {
108
-			$source = str_replace ( 'home::', '', $fileInfo->getStoragename () ) . '/' . $source;
108
+			$source = str_replace('home::', '', $fileInfo->getStoragename()) . '/' . $source;
109 109
 		} else {
110 110
 			$source = $this->userId . '/' . $source;
111 111
 		}
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
 	 * @throws NotFoundException
122 122
 	 */
123 123
 	public function buildFileInfo($files) {
124
-		$fileArray = array ();
125
-		foreach ( $files as $file ) {
124
+		$fileArray = array();
125
+		foreach ($files as $file) {
126 126
 			// Check if anything is missing and file type is correct
127
-			if (! empty ( $file ['id'] )) {
127
+			if (!empty ($file ['id'])) {
128 128
 				
129
-				$fileInfo = $this->fileMapper->find ( $file ['id'] );
130
-				$this->checkMimeType ( $fileInfo );
129
+				$fileInfo = $this->fileMapper->find($file ['id']);
130
+				$this->checkMimeType($fileInfo);
131 131
 				
132
-				array_push ( $fileArray, $fileInfo );
132
+				array_push($fileArray, $fileInfo);
133 133
 			} else {
134
-				throw new NotFoundException ( $this->l10n->t ( 'Wrong parameter.' ) );
134
+				throw new NotFoundException($this->l10n->t('Wrong parameter.'));
135 135
 			}
136 136
 		}
137 137
 		return $fileArray;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return integer
145 145
 	 */
146 146
 	public function getCorrectType($fileInfo) {
147
-		if ($fileInfo->getMimetype () === OcrConstants::MIME_TYPE_PDF) {
147
+		if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
148 148
 			return OcrConstants::OCRmyPDF;
149 149
 		} else {
150 150
 			return OcrConstants::TESSERACT;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $pathToFile        	
160 160
 	 */
161 161
 	public function execRemove($pathToFile) {
162
-		exec ( 'rm ' . $pathToFile );
162
+		exec('rm ' . $pathToFile);
163 163
 	}
164 164
 	
165 165
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return string
172 172
 	 */
173 173
 	public function getFileContents($pathToFile) {
174
-		return file_get_contents ( $pathToFile );
174
+		return file_get_contents($pathToFile);
175 175
 	}
176 176
 	
177 177
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return boolean
184 184
 	 */
185 185
 	public function fileExists($pathToFile) {
186
-		return file_exists ( $pathToFile );
186
+		return file_exists($pathToFile);
187 187
 	}
188 188
 	
189 189
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @return string
197 197
 	 */
198 198
 	public function buildNotExistingFilename($filePath, $fileName) {
199
-		return \OCP\Files::buildNotExistingFileName ( $filePath, $fileName . '_OCR.pdf' );
199
+		return \OCP\Files::buildNotExistingFileName($filePath, $fileName . '_OCR.pdf');
200 200
 	}
201 201
 	
202 202
 	/**
@@ -210,29 +210,29 @@  discard block
 block discarded – undo
210 210
 	 * @return string
211 211
 	 */
212 212
 	private function buildTargetForShared(File $fileInfo) {
213
-		$share = $this->shareMapper->find ( $fileInfo->getFileid (), $this->userId, str_replace ( 'home::', '', $fileInfo->getStoragename () ) );
213
+		$share = $this->shareMapper->find($fileInfo->getFileid(), $this->userId, str_replace('home::', '', $fileInfo->getStoragename()));
214 214
 		
215 215
 		// get rid of the .png or .pdf and so on
216
-		$fileName = substr ( $share->getFileTarget (), 0, (strrpos ( $share->getFileTarget (), '.' )) ); // '/thedom.png' => '/thedom' || '/Test/thedom.png' => '/Test/thedom'
216
+		$fileName = substr($share->getFileTarget(), 0, (strrpos($share->getFileTarget(), '.'))); // '/thedom.png' => '/thedom' || '/Test/thedom.png' => '/Test/thedom'
217 217
 		                                                                                                 
218 218
 		// remove everything in front of and including of the first appearance of a slash from behind
219
-		$fileName = substr ( strrchr ( $fileName, "/" ), 1 ); // '/thedom' => 'thedom' || '/Test/thedom' => 'thedom'
219
+		$fileName = substr(strrchr($fileName, "/"), 1); // '/thedom' => 'thedom' || '/Test/thedom' => 'thedom'
220 220
 		                                                      
221 221
 		// eliminate the file name from the path
222
-		$filePath = dirname ( $share->getFileTarget () ); // '/thedom.png' => '/' || '/Test/thedom.png' => '/Test'
222
+		$filePath = dirname($share->getFileTarget()); // '/thedom.png' => '/' || '/Test/thedom.png' => '/Test'
223 223
 		                                                  
224 224
 		// replace the first slash
225
-		$pos = strpos ( $filePath, '/' );
225
+		$pos = strpos($filePath, '/');
226 226
 		if ($pos !== false) {
227
-			$filePath = substr_replace ( $filePath, '', $pos, strlen ( '/' ) ); // '/' => '' || '/Test/' => 'Test'
227
+			$filePath = substr_replace($filePath, '', $pos, strlen('/')); // '/' => '' || '/Test/' => 'Test'
228 228
 		}
229 229
 		
230
-		if ($fileInfo->getMimetype () === OcrConstants::MIME_TYPE_PDF) {
230
+		if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
231 231
 			// PDFs:
232
-			return $this->buildNotExistingFilename ( $filePath, $fileName . '_OCR.pdf' );
232
+			return $this->buildNotExistingFilename($filePath, $fileName . '_OCR.pdf');
233 233
 		} else {
234 234
 			// IMAGES:
235
-			return $this->buildNotExistingFilename ( $filePath, $fileName . '_OCR.txt' );
235
+			return $this->buildNotExistingFilename($filePath, $fileName . '_OCR.txt');
236 236
 		}
237 237
 	}
238 238
 	
@@ -248,29 +248,29 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	private function buildTargetNotForShared(File $fileInfo) {
250 250
 		// get rid of the .png or .pdf and so on
251
-		$fileName = substr ( $fileInfo->getName (), 0, (strrpos ( $fileInfo->getName (), '.' )) ); // 'thedom.png' => 'thedom'
251
+		$fileName = substr($fileInfo->getName(), 0, (strrpos($fileInfo->getName(), '.'))); // 'thedom.png' => 'thedom'
252 252
 		                                                                                           
253 253
 		// eliminate the file name from the path
254
-		$filePath = str_replace ( $fileInfo->getName (), '', $fileInfo->getPath () ); // 'files/Test/thedom.png' => 'files/Test/' || 'files/thedom.png' => 'files/'
254
+		$filePath = str_replace($fileInfo->getName(), '', $fileInfo->getPath()); // 'files/Test/thedom.png' => 'files/Test/' || 'files/thedom.png' => 'files/'
255 255
 		                                                                              
256 256
 		// and get the path on top of the files/ dir
257
-		$filePath = str_replace ( 'files', '', $filePath ); // 'files/Test/' => '/Test/' || 'files/' => '/'
257
+		$filePath = str_replace('files', '', $filePath); // 'files/Test/' => '/Test/' || 'files/' => '/'
258 258
 		                                                    
259 259
 		// remove the last slash
260
-		$filePath = substr_replace ( $filePath, '', strrpos ( $filePath, '/' ), strlen ( '/' ) ); // '/Test/' => '/Test' || '/' => ''
260
+		$filePath = substr_replace($filePath, '', strrpos($filePath, '/'), strlen('/')); // '/Test/' => '/Test' || '/' => ''
261 261
 		                                                                                          
262 262
 		// replace the first slash
263
-		$pos = strpos ( $filePath, '/' );
263
+		$pos = strpos($filePath, '/');
264 264
 		if ($pos !== false) {
265
-			$filePath = substr_replace ( $filePath, '', $pos, strlen ( '/' ) ); // '/Test' => '// 'Test' || '/' => ''
265
+			$filePath = substr_replace($filePath, '', $pos, strlen('/')); // '/Test' => '// 'Test' || '/' => ''
266 266
 		}
267 267
 		
268
-		if ($fileInfo->getMimetype () === OcrConstants::MIME_TYPE_PDF) {
268
+		if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
269 269
 			// PDFs:
270
-			return $this->buildNotExistingFilename ( $filePath, $fileName . '_OCR.pdf' );
270
+			return $this->buildNotExistingFilename($filePath, $fileName . '_OCR.pdf');
271 271
 		} else {
272 272
 			// IMAGES:
273
-			return $this->buildNotExistingFilename ( $filePath, $fileName . '_OCR.txt' );
273
+			return $this->buildNotExistingFilename($filePath, $fileName . '_OCR.txt');
274 274
 		}
275 275
 	}
276 276
 	
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 * @param File $fileInfo        	
281 281
 	 */
282 282
 	private function checkMimeType(File $fileInfo) {
283
-		if (! $fileInfo || ! in_array ( $fileInfo->getMimetype (), OcrConstants::ALLOWED_MIME_TYPES )) {
284
-			$this->logger->debug ( 'Getting FileInfo did not work or not included in the ALLOWED_MIMETYPES array.' );
285
-			throw new NotFoundException ( $this->l10n->t ( 'Wrong MIME type.' ) );
283
+		if (!$fileInfo || !in_array($fileInfo->getMimetype(), OcrConstants::ALLOWED_MIME_TYPES)) {
284
+			$this->logger->debug('Getting FileInfo did not work or not included in the ALLOWED_MIMETYPES array.');
285
+			throw new NotFoundException($this->l10n->t('Wrong MIME type.'));
286 286
 		}
287 287
 	}
288 288
 }
289 289
\ No newline at end of file
Please login to merge, or discard this patch.