Fixes for #5252

Fixes for #5252 and refactoring. Perhaps you need to fix js validation too. I did not watch it.
```php
$v->range = [123, 124,5,8, 0];
$v->not = false;
var_dump($v->validate(0));//true
$v->not = true;
var_dump($v->validate(0));//false
```