Code Duplication    Length = 19-19 lines in 3 locations

apps/testing/lib/Controller/LockingController.php 3 locations

@@ 124-142 (lines=19) @@
121
	 * @return DataResponse
122
	 * @throws OCSException
123
	 */
124
	public function acquireLock($type, $user, $path) {
125
		try {
126
			$path = $this->getPath($user, $path);
127
		} catch (NoUserException $e) {
128
			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
129
		} catch (NotFoundException $e) {
130
			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
131
		}
132
133
		$lockingProvider = $this->getLockingProvider();
134
135
		try {
136
			$lockingProvider->acquireLock($path, $type);
137
			$this->config->setAppValue('testing', 'locking_' . $path, $type);
138
			return new DataResponse();
139
		} catch (LockedException $e) {
140
			throw new OCSException('', Http::STATUS_LOCKED, $e);
141
		}
142
	}
143
144
	/**
145
	 * @param int $type
@@ 151-169 (lines=19) @@
148
	 * @return DataResponse
149
	 * @throws OCSException
150
	 */
151
	public function changeLock($type, $user, $path) {
152
		try {
153
			$path = $this->getPath($user, $path);
154
		} catch (NoUserException $e) {
155
			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
156
		} catch (NotFoundException $e) {
157
			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
158
		}
159
160
		$lockingProvider = $this->getLockingProvider();
161
162
		try {
163
			$lockingProvider->changeLock($path, $type);
164
			$this->config->setAppValue('testing', 'locking_' . $path, $type);
165
			return new DataResponse();
166
		} catch (LockedException $e) {
167
			throw new OCSException('', Http::STATUS_LOCKED, $e);
168
		}
169
	}
170
171
	/**
172
	 * @param int $type
@@ 178-196 (lines=19) @@
175
	 * @return DataResponse
176
	 * @throws OCSException
177
	 */
178
	public function releaseLock($type, $user, $path) {
179
		try {
180
			$path = $this->getPath($user, $path);
181
		} catch (NoUserException $e) {
182
			throw new OCSException('User not found', Http::STATUS_NOT_FOUND, $e);
183
		} catch (NotFoundException $e) {
184
			throw new OCSException('Path not found', Http::STATUS_NOT_FOUND, $e);
185
		}
186
187
		$lockingProvider = $this->getLockingProvider();
188
189
		try {
190
			$lockingProvider->releaseLock($path, $type);
191
			$this->config->deleteAppValue('testing', 'locking_' . $path);
192
			return new DataResponse();
193
		} catch (LockedException $e) {
194
			throw new OCSException('', Http::STATUS_LOCKED, $e);
195
		}
196
	}
197
198
	/**
199
	 * @param int $type