Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
MathMLValidator | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
validate | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
setOptions | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\MathSearch\Wikidata\MathML; |
4 | |
5 | use DataValues\StringValue; |
6 | use ValueFormatters; |
7 | use ValueValidators\Result; |
8 | use ValueValidators\ValueValidator; |
9 | |
10 | /** |
11 | * @author Duc Linh Tran |
12 | * @author Julian Hilbig |
13 | * @author Moritz Schubotz |
14 | */ |
15 | class MathMLValidator implements ValueValidator { |
16 | |
17 | /** |
18 | * Validates a value with MathLaTeXML |
19 | * |
20 | * @param mixed $value The value to validate |
21 | * |
22 | * @return \ValueValidators\Result |
23 | * @throws ValueFormatters\Exceptions\MismatchingDataValueTypeException |
24 | */ |
25 | public function validate( $value ) { |
26 | if ( !( $value instanceof StringValue ) ) { |
27 | throw new InvalidArgumentException( '$value must be a StringValue' ); |
28 | } |
29 | |
30 | return Result::newSuccess(); |
31 | } |
32 | |
33 | /** |
34 | * @param array $options |
35 | * @see ValueValidator::setOptions() |
36 | * |
37 | */ |
38 | public function setOptions( array $options ) { |
39 | // Do nothing. This method shouldn't even be in the interface. |
40 | } |
41 | } |