Code Duplication    Length = 10-10 lines in 4 locations

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

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