Code Duplication    Length = 14-15 lines in 2 locations

lib/private/Console/Application.php 1 location

@@ 161-175 (lines=15) @@
158
		return $this->application->run($input, $output);
159
	}
160
161
	private function loadCommandsFromInfoXml($commands) {
162
		foreach ($commands as $command) {
163
			try {
164
				$c = \OC::$server->query($command);
165
			} catch (QueryException $e) {
166
				if (class_exists($command)) {
167
					$c = new $command();
168
				} else {
169
					throw new \Exception("Console command '$command' is unknown and could not be loaded");
170
				}
171
			}
172
173
			$this->application->add($c);
174
		}
175
	}
176
}
177

lib/private/DB/MigrationService.php 1 location

@@ 352-365 (lines=14) @@
349
	/**
350
	 * @param string $version
351
	 */
352
	protected function createInstance($version) {
353
		$class = $this->getClass($version);
354
		try {
355
			$s = \OC::$server->query($class);
356
		} catch (QueryException $e) {
357
			if (class_exists($class)) {
358
				$s = new $class();
359
			} else {
360
				throw new \Exception("Migration step '$class' is unknown");
361
			}
362
		}
363
364
		return $s;
365
	}
366
367
	/**
368
	 * Executes one explicit version