Code Duplication    Length = 10-10 lines in 4 locations

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

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