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

@@ 89-97 (lines=9) @@
86
				}
87
			}
88
			if ( !$allowedQualifier ) {
89
				if ( empty( $properties ) || $properties === [ '' ] ) {
90
					$message = ( new ViolationMessage( 'wbqc-violation-message-no-qualifiers' ) )
91
						->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY );
92
				} else {
93
					$message = ( new ViolationMessage( 'wbqc-violation-message-qualifiers' ) )
94
						->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
95
						->withEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE )
96
						->withEntityIdList( $properties, Role::QUALIFIER_PREDICATE );
97
				}
98
				$status = CheckResult::STATUS_VIOLATION;
99
				break;
100
			}