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