Code Duplication    Length = 18-18 lines in 3 locations

controller/settingscontroller.php 3 locations

@@ 120-137 (lines=18) @@
117
	 * @param string $view
118
	 * @return JSONResponse
119
	 */
120
	private function setView($view) {
121
		if (!$this->isViewAllowed($view)) {
122
			return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY);
123
		}
124
125
		try {
126
			$this->config->setUserValue(
127
				$this->userId,
128
				$this->appName,
129
				'currentView',
130
				$view
131
			);
132
		} catch(\Exception $e) {
133
			return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
134
		}
135
136
		return new JSONResponse();
137
	}
138
139
140
	/**
@@ 184-201 (lines=18) @@
181
	 * @param $value
182
	 * @return JSONResponse
183
	 */
184
	private function setSkipPopover($value) {
185
		if (!$this->isSkipPopoverValueAllowed($value)) {
186
			return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY);
187
		}
188
189
		try {
190
			$this->config->setUserValue(
191
				$this->userId,
192
				$this->appName,
193
				'skipPopover',
194
				$value
195
			);
196
		} catch(\Exception $e) {
197
			return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
198
		}
199
200
		return new JSONResponse();
201
	}
202
203
	/**
204
	 * get if popover shall be skipped
@@ 246-263 (lines=18) @@
243
	 * @param $value
244
	 * @return JSONResponse
245
	 */
246
	private function setShowWeekNr($value) {
247
		if (!$this->isShowWeekNrValueAllowed($value)) {
248
			return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY);
249
		}
250
251
		try {
252
			$this->config->setUserValue(
253
				$this->userId,
254
				$this->appName,
255
				'showWeekNr',
256
				$value
257
			);
258
		} catch(\Exception $e) {
259
			return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
260
		}
261
262
		return new JSONResponse();
263
	}
264
265
	/**
266
	 * get config value for showing week numbers