Code Duplication    Length = 16-16 lines in 2 locations

src/ConstraintCheck/Message/ViolationMessageDeserializer.php 1 location

@@ 161-176 (lines=16) @@
158
	 * @param string $contextTypeAbbreviation
159
	 * @return string one of the Context::TYPE_* constants
160
	 */
161
	private function deserializeContextType( $contextTypeAbbreviation ) {
162
		switch ( $contextTypeAbbreviation ) {
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 context type abbreviation ' . $contextTypeAbbreviation
173
				);
174
				// @codeCoverageIgnoreEnd
175
		}
176
	}
177
178
	/**
179
	 * @param string[] $contextTypeAbbreviations

src/ConstraintCheck/Message/ViolationMessageSerializer.php 1 location

@@ 156-171 (lines=16) @@
153
	 * @param string $contextType one of the Context::TYPE_* constants
154
	 * @return string the abbreviated context type
155
	 */
156
	private function serializeContextType( $contextType ) {
157
		switch ( $contextType ) {
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 context type ' . $contextType
168
				);
169
				// @codeCoverageIgnoreEnd
170
		}
171
	}
172
173
	/**
174
	 * @param string[] $contextTypeList Context::TYPE_* constants