Code Duplication    Length = 14-15 lines in 2 locations

lib/private/Console/Application.php 1 location

@@ 173-187 (lines=15) @@
170
		return $this->application->run($input, $output);
171
	}
172
173
	private function loadCommandsFromInfoXml($commands) {
174
		foreach ($commands as $command) {
175
			try {
176
				$c = \OC::$server->query($command);
177
			} catch (QueryException $e) {
178
				if (class_exists($command)) {
179
					$c = new $command();
180
				} else {
181
					throw new \Exception("Console command '$command' is unknown and could not be loaded");
182
				}
183
			}
184
185
			$this->application->add($c);
186
		}
187
	}
188
}
189

lib/private/DB/MigrationService.php 1 location

@@ 370-383 (lines=14) @@
367
	 * @return mixed
368
	 * @throws \InvalidArgumentException
369
	 */
370
	protected function createInstance($version) {
371
		$class = $this->getClass($version);
372
		try {
373
			$s = \OC::$server->query($class);
374
		} catch (QueryException $e) {
375
			if (class_exists($class)) {
376
				$s = new $class();
377
			} else {
378
				throw new \InvalidArgumentException("Migration step '$class' is unknown");
379
			}
380
		}
381
382
		return $s;
383
	}
384
385
	/**
386
	 * Executes one explicit version