| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | protected function _validate() |
||
| 29 | { |
||
| 30 | if(!is_scalar($this->value)) { |
||
| 31 | return null; |
||
| 32 | } |
||
| 33 | |||
| 34 | // the only scalar value we do not want to work with |
||
| 35 | // is a boolan, which is converted to an integer when |
||
| 36 | // converted to string, which in turn can be validated |
||
| 37 | // with a regex. |
||
| 38 | if(is_bool($this->value)) { |
||
| 39 | return null; |
||
| 40 | } |
||
| 41 | |||
| 42 | $value = (string)$this->value; |
||
| 43 | |||
| 44 | if(preg_match($this->getStringOption('regex'), $value)) { |
||
| 45 | return $value; |
||
| 46 | } |
||
| 47 | |||
| 48 | return null; |
||
| 49 | } |
||
| 51 |