Code Duplication    Length = 12-12 lines in 3 locations

apps/files_external/lib/Command/Create.php 1 location

@@ 210-221 (lines=12) @@
207
		$listCommand->listMounts($user, [$mount], $listInput, $output);
208
	}
209
210
	protected function getStorageService($userId) {
211
		if (!empty($userId)) {
212
			$user = $this->userManager->get($userId);
213
			if (is_null($user)) {
214
				throw new NoUserException("user $userId not found");
215
			}
216
			$this->userSession->setUser($user);
217
			return $this->userService;
218
		} else {
219
			return $this->globalService;
220
		}
221
	}
222
}
223

apps/files_external/lib/Command/Import.php 1 location

@@ 212-223 (lines=12) @@
209
		}
210
	}
211
212
	protected function getStorageService($userId) {
213
		if (!empty($userId)) {
214
			$user = $this->userManager->get($userId);
215
			if (is_null($user)) {
216
				throw new NoUserException("user $userId not found");
217
			}
218
			$this->userSession->setUser($user);
219
			return $this->userService;
220
		} else {
221
			return $this->globalService;
222
		}
223
	}
224
}
225

apps/files_external/lib/Command/ListCommand.php 1 location

@@ 262-273 (lines=12) @@
259
		}
260
	}
261
262
	protected function getStorageService($userId) {
263
		if (!empty($userId)) {
264
			$user = $this->userManager->get($userId);
265
			if (is_null($user)) {
266
				throw new NoUserException("user $userId not found");
267
			}
268
			$this->userSession->setUser($user);
269
			return $this->userService;
270
		} else {
271
			return $this->globalService;
272
		}
273
	}
274
}
275