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 ($user === null) {
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

@@ 204-215 (lines=12) @@
201
		}
202
	}
203
204
	protected function getStorageService($userId) {
205
		if (!empty($userId)) {
206
			$user = $this->userManager->get($userId);
207
			if ($user === null) {
208
				throw new NoUserException("user $userId not found");
209
			}
210
			$this->userSession->setUser($user);
211
			return $this->userService;
212
		} else {
213
			return $this->globalService;
214
		}
215
	}
216
}
217

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

@@ 332-343 (lines=12) @@
329
		}
330
	}
331
	
332
	protected function getStorageService($userId) {
333
		if (!empty($userId)) {
334
			$user = $this->userManager->get($userId);
335
			if ($user === null) {
336
				throw new NoUserException("user $userId not found");
337
			}
338
			$this->userSession->setUser($user);
339
			return $this->userService;
340
		} else {
341
			return $this->globalService;
342
		}
343
	}
344
}
345