Code Duplication    Length = 18-18 lines in 3 locations

controller/settingscontroller.php 3 locations

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