| Conditions | 5 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function doValidation( $value ) { |
||
| 28 | if ( !is_array( $value ) ) { |
||
| 29 | $this->addErrorMessage( 'Not an array' ); |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $options = array(); |
||
| 34 | |||
| 35 | if ( array_key_exists( 'elementcount', $this->options ) ) { |
||
| 36 | $options['range'] = $this->options['elementcount']; |
||
| 37 | } |
||
| 38 | |||
| 39 | if ( array_key_exists( 'minelements', $this->options ) ) { |
||
| 40 | $options['lowerbound'] = $this->options['minelements']; |
||
| 41 | } |
||
| 42 | |||
| 43 | if ( array_key_exists( 'maxelements', $this->options ) ) { |
||
| 44 | $options['upperbound'] = $this->options['maxelements']; |
||
| 45 | } |
||
| 46 | |||
| 47 | $validator = new RangeValidator(); |
||
| 48 | $validator->setOptions( $options ); |
||
| 49 | $this->runSubValidator( count( $value ), $validator, 'length' ); |
||
| 50 | } |
||
| 51 | |||
| 64 |