This validator is only for use with Phalcon\Mvc\Collection. If you are using
Phalcon\Mvc\Model, please use the validators provided by Phalcon\Validation.

<?phpusePhalcon\Mvc\Model\Validator\Ip;classDataextends\Phalcon\Mvc\Collection{publicfunctionvalidation(){// Any pubic IP$this->validate(newIP(["field"=>"server_ip","version"=>IP::VERSION_4|IP::VERSION_6,// v6 and v4. The same if not specified"allowReserved"=>false,// False if not specified. Ignored for v6"allowPrivate"=>false,// False if not specified"message"=>"IP address has to be correct",]));// Any public v4 address$this->validate(newIP(["field"=>"ip_4","version"=>IP::VERSION_4,"message"=>"IP address has to be correct",]));// Any v6 address$this->validate(newIP(["field"=>"ip6","version"=>IP::VERSION_6,"allowPrivate"=>true,"message"=>"IP address has to be correct",]));if($this->validationHasFailed()===true){returnfalse;}}}