Code Duplication    Length = 10-10 lines in 4 locations

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

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