Code Duplication    Length = 16-16 lines in 4 locations

src/ConstraintCheck/Message/ViolationMessageDeserializer.php 2 locations

@@ 161-176 (lines=16) @@
158
	 * @param string $scopeAbbreviation
159
	 * @return string one of the Context::TYPE_* constants
160
	 */
161
	private function deserializeConstraintScope( $scopeAbbreviation ) {
162
		switch ( $scopeAbbreviation ) {
163
			case 's':
164
				return Context::TYPE_STATEMENT;
165
			case 'q':
166
				return Context::TYPE_QUALIFIER;
167
			case 'r':
168
				return Context::TYPE_REFERENCE;
169
			default:
170
				// @codeCoverageIgnoreStart
171
				throw new LogicException(
172
					'Unknown constraint scope abbreviation ' . $scopeAbbreviation
173
				);
174
				// @codeCoverageIgnoreEnd
175
		}
176
	}
177
178
	/**
179
	 * @param string[] $scopeAbbreviations
@@ 190-205 (lines=16) @@
187
	 * @param string $scopeAbbreviation
188
	 * @return string one of the Context::TYPE_* constants
189
	 */
190
	private function deserializePropertyScope( $scopeAbbreviation ) {
191
		switch ( $scopeAbbreviation ) {
192
			case 's':
193
				return Context::TYPE_STATEMENT;
194
			case 'q':
195
				return Context::TYPE_QUALIFIER;
196
			case 'r':
197
				return Context::TYPE_REFERENCE;
198
			default:
199
				// @codeCoverageIgnoreStart
200
				throw new LogicException(
201
					'Unknown property scope abbreviation ' . $scopeAbbreviation
202
				);
203
				// @codeCoverageIgnoreEnd
204
		}
205
	}
206
207
	/**
208
	 * @param string[] $scopeAbbreviations

src/ConstraintCheck/Message/ViolationMessageSerializer.php 2 locations

@@ 156-171 (lines=16) @@
153
	 * @param string $scope one of the Context::TYPE_* constants
154
	 * @return string the abbreviated scope
155
	 */
156
	private function serializeConstraintScope( $scope ) {
157
		switch ( $scope ) {
158
			case Context::TYPE_STATEMENT:
159
				return 's';
160
			case Context::TYPE_QUALIFIER:
161
				return 'q';
162
			case Context::TYPE_REFERENCE:
163
				return 'r';
164
			default:
165
				// @codeCoverageIgnoreStart
166
				throw new LogicException(
167
					'Unknown constraint scope ' . $scope
168
				);
169
				// @codeCoverageIgnoreEnd
170
		}
171
	}
172
173
	/**
174
	 * @param string[] $scopeList Context::TYPE_* constants
@@ 185-200 (lines=16) @@
182
	 * @param string $scope one of the Context::TYPE_* constants
183
	 * @return string the abbreviated scope
184
	 */
185
	private function serializePropertyScope( $scope ) {
186
		switch ( $scope ) {
187
			case Context::TYPE_STATEMENT:
188
				return 's';
189
			case Context::TYPE_QUALIFIER:
190
				return 'q';
191
			case Context::TYPE_REFERENCE:
192
				return 'r';
193
			default:
194
				// @codeCoverageIgnoreStart
195
				throw new LogicException(
196
					'Unknown property scope ' . $scope
197
				);
198
				// @codeCoverageIgnoreEnd
199
		}
200
	}
201
202
	/**
203
	 * @param string[] $scopeList Context::TYPE_* constants