Code Duplication    Length = 10-10 lines in 4 locations

apps/theming/lib/Controller/ThemingController.php 4 locations

@@ 144-153 (lines=10) @@
141
	public function updateStylesheet($setting, $value) {
142
		$value = trim($value);
143
		switch ($setting) {
144
			case 'name':
145
				if (strlen($value) > 250) {
146
					return new DataResponse([
147
						'data' => [
148
							'message' => $this->l10n->t('The given name is too long'),
149
						],
150
						'status' => 'error'
151
					]);
152
				}
153
				break;
154
			case 'url':
155
				if (strlen($value) > 500) {
156
					return new DataResponse([
@@ 154-163 (lines=10) @@
151
					]);
152
				}
153
				break;
154
			case 'url':
155
				if (strlen($value) > 500) {
156
					return new DataResponse([
157
						'data' => [
158
							'message' => $this->l10n->t('The given web address is too long'),
159
						],
160
						'status' => 'error'
161
					]);
162
				}
163
				break;
164
			case 'slogan':
165
				if (strlen($value) > 500) {
166
					return new DataResponse([
@@ 164-173 (lines=10) @@
161
					]);
162
				}
163
				break;
164
			case 'slogan':
165
				if (strlen($value) > 500) {
166
					return new DataResponse([
167
						'data' => [
168
							'message' => $this->l10n->t('The given slogan is too long'),
169
						],
170
						'status' => 'error'
171
					]);
172
				}
173
				break;
174
			case 'color':
175
				if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
176
					return new DataResponse([
@@ 174-183 (lines=10) @@
171
					]);
172
				}
173
				break;
174
			case 'color':
175
				if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
176
					return new DataResponse([
177
						'data' => [
178
							'message' => $this->l10n->t('The given color is invalid'),
179
						],
180
						'status' => 'error'
181
					]);
182
				}
183
				break;
184
		}
185
186
		$this->themingDefaults->set($setting, $value);