Code Duplication    Length = 6-7 lines in 6 locations

src/ConstraintCheck/Checker/ContemporaryChecker.php 1 location

@@ 102-108 (lines=7) @@
99
			// nothing to check
100
			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
101
		}
102
		if ( $snak->getDataValue()->getType() !== 'wikibase-entityid' ) {
103
			// wrong data type
104
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
105
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
106
				->withDataValueType( 'wikibase-entityid' );
107
			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
108
		}
109
110
		/** @var EntityId $objectId */
111
		$objectId = $snak->getDataValue()->getEntityId();

src/ConstraintCheck/Checker/InverseChecker.php 1 location

@@ 110-115 (lines=6) @@
107
		 * error handling:
108
		 *   type of $dataValue for properties with 'Inverse' constraint has to be 'wikibase-entityid'
109
		 */
110
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
111
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
112
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
113
				->withDataValueType( 'wikibase-entityid' );
114
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
115
		}
116
		/** @var EntityIdValue $dataValue */
117
118
		$targetEntityId = $dataValue->getEntityId();

src/ConstraintCheck/Checker/SymmetricChecker.php 1 location

@@ 97-102 (lines=6) @@
94
		 * error handling:
95
		 *   type of $dataValue for properties with 'Symmetric' constraint has to be 'wikibase-entityid'
96
		 */
97
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
98
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
99
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
100
				->withDataValueType( 'wikibase-entityid' );
101
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
102
		}
103
		/** @var EntityIdValue $dataValue */
104
105
		$targetEntityId = $dataValue->getEntityId();

src/ConstraintCheck/Checker/TargetRequiredClaimChecker.php 1 location

@@ 111-116 (lines=6) @@
108
		 * error handling:
109
		 *   type of $dataValue for properties with 'Target required claim' constraint has to be 'wikibase-entityid'
110
		 */
111
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
112
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
113
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
114
				->withDataValueType( 'wikibase-entityid' );
115
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
116
		}
117
		/** @var EntityIdValue $dataValue */
118
119
		$targetEntityId = $dataValue->getEntityId();

src/ConstraintCheck/Checker/ValueTypeChecker.php 1 location

@@ 133-138 (lines=6) @@
130
		 * error handling:
131
		 *   type of $dataValue for properties with 'Value type' constraint has to be 'wikibase-entityid'
132
		 */
133
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
134
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
135
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
136
				->withDataValueType( 'wikibase-entityid' );
137
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
138
		}
139
		/** @var EntityIdValue $dataValue */
140
141
		try {

src/ConstraintCheck/Checker/CommonsLinkChecker.php 1 location

@@ 125-130 (lines=6) @@
122
		 *   type of $dataValue for properties with 'Commons link' constraint has to be 'string'
123
		 *   parameter $namespace can be null, works for commons galleries
124
		 */
125
		if ( $dataValue->getType() !== 'string' ) {
126
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
127
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
128
				->withDataValueType( 'string' );
129
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
130
		}
131
132
		$commonsLink = $dataValue->getValue();
133