Add ping validation checks to ServerValidator
parent
3cd90b29ae
commit
5c0e889dd2
|
@ -101,6 +101,11 @@ class ServerValidator {
|
||||||
throw new \InvalidArgumentException('server_ip_bad_service');
|
throw new \InvalidArgumentException('server_ip_bad_service');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'ping':
|
||||||
|
if(!filter_var($value, FILTER_VALIDATE_IP)) {
|
||||||
|
throw new \InvalidArgumentException('server_ip_bad_service');
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -113,7 +118,7 @@ class ServerValidator {
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function type($type) {
|
public function type($type) {
|
||||||
if(!in_array($type, array('service', 'website'))) {
|
if(!in_array($type, array('ping', 'service', 'website'))) {
|
||||||
throw new \InvalidArgumentException('server_type_invalid');
|
throw new \InvalidArgumentException('server_type_invalid');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue