@@ 99-106 (lines=8) @@ | ||
96 | * @param string $parameterId |
|
97 | * @throws ConstraintParameterException |
|
98 | */ |
|
99 | private function requireSingleParameter( array $parameters, $parameterId ) { |
|
100 | if ( count( $parameters[$parameterId] ) !== 1 ) { |
|
101 | throw new ConstraintParameterException( |
|
102 | ( new ViolationMessage( 'wbqc-violation-message-parameter-single' ) ) |
|
103 | ->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY ) |
|
104 | ); |
|
105 | } |
|
106 | } |
|
107 | ||
108 | /** |
|
109 | * Require that $snak is a {@link PropertyValueSnak}. |
|
@@ 115-122 (lines=8) @@ | ||
112 | * @return void |
|
113 | * @throws ConstraintParameterException |
|
114 | */ |
|
115 | private function requireValueParameter( Snak $snak, $parameterId ) { |
|
116 | if ( !( $snak instanceof PropertyValueSnak ) ) { |
|
117 | throw new ConstraintParameterException( |
|
118 | ( new ViolationMessage( 'wbqc-violation-message-parameter-value' ) ) |
|
119 | ->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY ) |
|
120 | ); |
|
121 | } |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * Parse a single entity ID parameter. |