Code Duplication    Length = 9-10 lines in 2 locations

src/ConstraintCheck/Checker/AllowedUnitsChecker.php 2 locations

@@ 115-124 (lines=10) @@
112
			}
113
		}
114
115
		if ( $status === CheckResult::STATUS_VIOLATION ) {
116
			$messageKey = $unitsParameter->getUnitlessAllowed() ?
117
				'wbqc-violation-message-units-or-none' :
118
				'wbqc-violation-message-units';
119
			$message = ( new ViolationMessage( $messageKey ) )
120
				->withEntityId( $snak->getPropertyId() )
121
				->withEntityIdList( $unitsParameter->getUnitItemIds() );
122
		} else {
123
			$message = null;
124
		}
125
126
		return new CheckResult( $context, $constraint, $parameters, $status, $message );
127
	}
@@ 142-150 (lines=9) @@
139
		UnitsParameter $unitsParameter,
140
		PropertyValueSnak $snak
141
	) {
142
		if ( $unitsParameter->getUnitlessAllowed() ) {
143
			$message = null;
144
			$status = CheckResult::STATUS_COMPLIANCE;
145
		} else {
146
			$message = ( new ViolationMessage( 'wbqc-violation-message-units' ) )
147
				->withEntityId( $snak->getPropertyId() )
148
				->withEntityIdList( $unitsParameter->getUnitItemIds() );
149
			$status = CheckResult::STATUS_VIOLATION;
150
		}
151
152
		return new CheckResult( $context, $constraint, [], $status, $message );
153
	}