Code Duplication    Length = 6-6 lines in 6 locations

src/ConstraintCheck/Checker/AllowedUnitsChecker.php 1 location

@@ 94-99 (lines=6) @@
91
		}
92
93
		$dataValue = $snak->getDataValue();
94
		if ( !$dataValue instanceof UnboundedQuantityValue ) {
95
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
96
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
97
				->withDataValueType( 'quantity' );
98
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
99
		}
100
101
		if ( $dataValue->getUnit() === '1' ) {
102
			return $this->checkUnitless( $context, $constraint, $unitsParameter, $snak );

src/ConstraintCheck/Checker/CommonsLinkChecker.php 1 location

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

src/ConstraintCheck/Checker/InverseChecker.php 1 location

@@ 118-123 (lines=6) @@
115
		 * error handling:
116
		 *   type of $dataValue for properties with 'Inverse' constraint has to be 'wikibase-entityid'
117
		 */
118
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
119
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
120
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
121
				->withDataValueType( 'wikibase-entityid' );
122
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
123
		}
124
		/** @var EntityIdValue $dataValue */
125
126
		$targetEntityId = $dataValue->getEntityId();

src/ConstraintCheck/Checker/SymmetricChecker.php 1 location

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

src/ConstraintCheck/Checker/TargetRequiredClaimChecker.php 1 location

@@ 119-124 (lines=6) @@
116
		 * error handling:
117
		 *   type of $dataValue for properties with 'Target required claim' constraint has to be 'wikibase-entityid'
118
		 */
119
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
120
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
121
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
122
				->withDataValueType( 'wikibase-entityid' );
123
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
124
		}
125
		/** @var EntityIdValue $dataValue */
126
127
		$targetEntityId = $dataValue->getEntityId();

src/ConstraintCheck/Checker/ValueTypeChecker.php 1 location

@@ 140-145 (lines=6) @@
137
		 * error handling:
138
		 *   type of $dataValue for properties with 'Value type' constraint has to be 'wikibase-entityid'
139
		 */
140
		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
141
			$message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) )
142
				->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM )
143
				->withDataValueType( 'wikibase-entityid' );
144
			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
145
		}
146
		/** @var EntityIdValue $dataValue */
147
148
		$item = $this->entityLookup->getEntity( $dataValue->getEntityId() );