Move custom libs to the source tree
This commit is contained in:
15
libs/SimpleValidator/Validators/Ip.php
Normal file
15
libs/SimpleValidator/Validators/Ip.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SimpleValidator\Validators;
|
||||
|
||||
class Ip extends Base
|
||||
{
|
||||
public function execute(array $data)
|
||||
{
|
||||
if ($this->isFieldNotEmpty($data)) {
|
||||
return filter_var($data[$this->field], FILTER_VALIDATE_IP) !== false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user