@@ 109-116 (lines=8) @@ | ||
106 | * @param string $parameterId |
|
107 | * @throws ConstraintParameterException |
|
108 | */ |
|
109 | private function requireSingleParameter( array $parameters, $parameterId ) { |
|
110 | if ( count( $parameters[$parameterId] ) !== 1 ) { |
|
111 | throw new ConstraintParameterException( |
|
112 | ( new ViolationMessage( 'wbqc-violation-message-parameter-single' ) ) |
|
113 | ->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY ) |
|
114 | ); |
|
115 | } |
|
116 | } |
|
117 | ||
118 | /** |
|
119 | * Require that $snak is a {@link PropertyValueSnak}. |
|
@@ 125-132 (lines=8) @@ | ||
122 | * @return void |
|
123 | * @throws ConstraintParameterException |
|
124 | */ |
|
125 | private function requireValueParameter( Snak $snak, $parameterId ) { |
|
126 | if ( !( $snak instanceof PropertyValueSnak ) ) { |
|
127 | throw new ConstraintParameterException( |
|
128 | ( new ViolationMessage( 'wbqc-violation-message-parameter-value' ) ) |
|
129 | ->withEntityId( new PropertyId( $parameterId ), Role::CONSTRAINT_PARAMETER_PROPERTY ) |
|
130 | ); |
|
131 | } |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * Parse a single entity ID parameter. |