Code Duplication    Length = 9-11 lines in 2 locations

src/ConstraintCheck/Checker/AllowedUnitsChecker.php 1 location

@@ 116-126 (lines=11) @@
113
		}
114
115
		if ( $status === CheckResult::STATUS_VIOLATION ) {
116
			if ( $unitsParameter->getUnitItemIds() === [] ) {
117
				$message = ( new ViolationMessage( 'wbqc-violation-message-units-none' ) )
118
					->withEntityId( $snak->getPropertyId(), Role::CONSTRAINT_PROPERTY );
119
			} else {
120
				$messageKey = $unitsParameter->getUnitlessAllowed() ?
121
					'wbqc-violation-message-units-or-none' :
122
					'wbqc-violation-message-units';
123
				$message = ( new ViolationMessage( $messageKey ) )
124
					->withEntityId( $snak->getPropertyId(), Role::CONSTRAINT_PROPERTY )
125
					->withEntityIdList( $unitsParameter->getUnitItemIds(), Role::CONSTRAINT_PARAMETER_VALUE );
126
			}
127
		} else {
128
			$message = null;
129
		}

src/ConstraintCheck/Checker/QualifiersChecker.php 1 location

@@ 98-106 (lines=9) @@
95
				}
96
			}
97
			if ( !$allowedQualifier ) {
98
				if ( empty( $properties ) || $properties === [ '' ] ) {
99
					$message = ( new ViolationMessage( 'wbqc-violation-message-no-qualifiers' ) )
100
						->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY );
101
				} else {
102
					$message = ( new ViolationMessage( 'wbqc-violation-message-qualifiers' ) )
103
						->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
104
						->withEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE )
105
						->withEntityIdList( $properties, Role::QUALIFIER_PREDICATE );
106
				}
107
				$status = CheckResult::STATUS_VIOLATION;
108
				break;
109
			}