Code Duplication    Length = 18-18 lines in 2 locations

core/Command/Db/Migrations/ExecuteCommand.php 1 location

@@ 113-130 (lines=18) @@
110
	 * @param CompletionContext $context
111
	 * @return string[]
112
	 */
113
	public function completeArgumentValues($argumentName, CompletionContext $context) {
114
		if ($argumentName === 'app') {
115
			$allApps = \OC_App::getAllApps();
116
			return array_diff($allApps, \OC_App::getEnabledApps(true, true));
117
		}
118
119
		if ($argumentName === 'version') {
120
			$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
121
122
			$ms = new MigrationService($appName, $this->connection);
123
			$migrations = $ms->getAvailableVersions();
124
125
			array_unshift($migrations, 'next', 'latest');
126
			return $migrations;
127
		}
128
129
		return [];
130
	}
131
132
}
133

core/Command/Db/Migrations/MigrateCommand.php 1 location

@@ 81-98 (lines=18) @@
78
	 * @param CompletionContext $context
79
	 * @return string[]
80
	 */
81
	public function completeArgumentValues($argumentName, CompletionContext $context) {
82
		if ($argumentName === 'app') {
83
			$allApps = \OC_App::getAllApps();
84
			return array_diff($allApps, \OC_App::getEnabledApps(true, true));
85
		}
86
87
		if ($argumentName === 'version') {
88
			$appName = $context->getWordAtIndex($context->getWordIndex() - 1);
89
90
			$ms = new MigrationService($appName, $this->connection);
91
			$migrations = $ms->getAvailableVersions();
92
93
			array_unshift($migrations, 'next', 'latest');
94
			return $migrations;
95
		}
96
97
		return [];
98
	}
99
100
}
101