| Conditions | 4 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function isValid($value) |
||
| 20 | { |
||
| 21 | $this->standardValue = null; |
||
| 22 | $this->value = $value; |
||
| 23 | |||
| 24 | if (!is_string($this->value)) { |
||
| 25 | $this->setError(static::E_NOT_STRING); |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | |||
| 29 | if ($this->options['trim'] === true) { |
||
| 30 | $this->value = trim($this->value); |
||
| 31 | } |
||
| 32 | |||
| 33 | if ($this->value !== '') { |
||
| 34 | $this->setError(static::E_NOT_EMPTY); |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | $this->standardValue = $this->value; |
||
| 39 | return true; |
||
| 40 | } |
||
| 42 |