Code Duplication    Length = 14-14 lines in 2 locations

src/ConstraintCheck/Helper/ConstraintParameterParser.php 2 locations

@@ 246-259 (lines=14) @@
243
	 * @throws ConstraintParameterException if the parameter is invalid or missing
244
	 * @return PropertyId
245
	 */
246
	public function parsePropertyParameter( array $constraintParameters, $constraintTypeItemId ) {
247
		$this->checkError( $constraintParameters );
248
		$propertyId = $this->config->get( 'WBQualityConstraintsPropertyId' );
249
		if ( !array_key_exists( $propertyId, $constraintParameters ) ) {
250
			throw new ConstraintParameterException(
251
				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
252
					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
253
					->withEntityId( new PropertyId( $propertyId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
254
			);
255
		}
256
257
		$this->requireSingleParameter( $constraintParameters, $propertyId );
258
		return $this->parsePropertyIdParameter( $constraintParameters[$propertyId][0], $propertyId );
259
	}
260
261
	private function parseItemIdParameter( PropertyValueSnak $snak, $parameterId ) {
262
		$dataValue = $snak->getDataValue();
@@ 533-546 (lines=14) @@
530
	 * @throws ConstraintParameterException if the parameter is invalid or missing
531
	 * @return string
532
	 */
533
	public function parseFormatParameter( array $constraintParameters, $constraintTypeItemId ) {
534
		$this->checkError( $constraintParameters );
535
		$formatId = $this->config->get( 'WBQualityConstraintsFormatAsARegularExpressionId' );
536
		if ( !array_key_exists( $formatId, $constraintParameters ) ) {
537
			throw new ConstraintParameterException(
538
				( new ViolationMessage( 'wbqc-violation-message-parameter-needed' ) )
539
					->withEntityId( new ItemId( $constraintTypeItemId ), Role::CONSTRAINT_TYPE_ITEM )
540
					->withEntityId( new PropertyId( $formatId ), Role::CONSTRAINT_PARAMETER_PROPERTY )
541
			);
542
		}
543
544
		$this->requireSingleParameter( $constraintParameters, $formatId );
545
		return $this->parseStringParameter( $constraintParameters[$formatId][0], $formatId );
546
	}
547
548
	/**
549
	 * @param array $constraintParameters see {@link \WikibaseQuality\Constraint::getConstraintParameters()}