Code Duplication    Length = 13-19 lines in 2 locations

src/ConstraintCheck/Checker/EntityTypeChecker.php 1 location

@@ 66-78 (lines=13) @@
63
		);
64
		$parameters['item'] = $entityTypes->getEntityTypes();
65
66
		if ( !in_array( $context->getEntity()->getType(), $entityTypes->getEntityTypes() ) ) {
67
			$message = ( new ViolationMessage( 'wbqc-violation-message-entityType' ) )
68
				->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
69
				->withEntityIdList( $entityTypes->getEntityTypeItemIds(), Role::CONSTRAINT_PARAMETER_VALUE );
70
71
			return new CheckResult(
72
				$context,
73
				$constraint,
74
				[],
75
				CheckResult::STATUS_VIOLATION,
76
				$message
77
			);
78
		}
79
80
		return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE );
81
	}

src/ConstraintCheck/Checker/PropertyScopeChecker.php 1 location

@@ 61-79 (lines=19) @@
58
			$constraintTypeItemId
59
		);
60
61
		if ( in_array( $context->getType(), $allowedContextTypes ) ) {
62
			return new CheckResult(
63
				$context->getCursor(),
64
				$constraint,
65
				[],
66
				CheckResult::STATUS_COMPLIANCE
67
			);
68
		} else {
69
			return new CheckResult(
70
				$context->getCursor(),
71
				$constraint,
72
				[],
73
				CheckResult::STATUS_VIOLATION,
74
				( new ViolationMessage( 'wbqc-violation-message-property-scope' ) )
75
					->withEntityId( $context->getSnak()->getPropertyId() )
76
					->withPropertyScope( $context->getType() )
77
					->withPropertyScopeList( $allowedContextTypes )
78
			);
79
		}
80
	}
81
82
	public function checkConstraintParameters( Constraint $constraint ) {