Code Duplication    Length = 8-9 lines in 4 locations

apps/files_external/lib/Controller/StoragesController.php 2 locations

@@ 204-212 (lines=9) @@
201
			);
202
		}
203
204
		if (!$backend->validateStorage($storage)) {
205
			// unsatisfied parameters
206
			return new DataResponse(
207
				array(
208
					'message' => (string)$this->l10n->t('Unsatisfied backend parameters')
209
				),
210
				Http::STATUS_UNPROCESSABLE_ENTITY
211
			);
212
		}
213
		if (!$authMechanism->validateStorage($storage)) {
214
			// unsatisfied parameters
215
			return new DataResponse(
@@ 213-221 (lines=9) @@
210
				Http::STATUS_UNPROCESSABLE_ENTITY
211
			);
212
		}
213
		if (!$authMechanism->validateStorage($storage)) {
214
			// unsatisfied parameters
215
			return new DataResponse(
216
				[
217
					'message' => (string)$this->l10n->t('Unsatisfied authentication mechanism parameters')
218
				],
219
				Http::STATUS_UNPROCESSABLE_ENTITY
220
			);
221
		}
222
223
		return null;
224
	}

apps/files_external/lib/Controller/UserGlobalStoragesController.php 1 location

@@ 162-169 (lines=8) @@
159
			if ($authMechanism instanceof IUserProvided) {
160
				$authMechanism->saveBackendOptions($this->userSession->getUser(), $id, $backendOptions);
161
				$authMechanism->manipulateStorageConfig($storage, $this->userSession->getUser());
162
			} else {
163
				return new DataResponse(
164
					[
165
						'message' => (string)$this->l10n->t('Storage with id "%i" is not user editable', array($id))
166
					],
167
					Http::STATUS_FORBIDDEN
168
				);
169
			}
170
		} catch (NotFoundException $e) {
171
			return new DataResponse(
172
				[

apps/theming/lib/Controller/ThemingController.php 1 location

@@ 176-184 (lines=9) @@
173
	public function updateLogo() {
174
		$newLogo = $this->request->getUploadedFile('uploadlogo');
175
		$newBackgroundLogo = $this->request->getUploadedFile('upload-login-background');
176
		if (empty($newLogo) && empty($newBackgroundLogo)) {
177
			return new DataResponse(
178
				[
179
					'data' => [
180
						'message' => $this->l->t('No file uploaded')
181
					]
182
				],
183
				Http::STATUS_UNPROCESSABLE_ENTITY
184
			);
185
		}
186
		$name = '';
187
		if(!empty($newLogo)) {