Add ping validation checks to ServerValidator

This commit is contained in:
Tom Hatzer 2016-12-23 11:38:47 +01:00 committed by GitHub
parent 3cd90b29ae
commit 5c0e889dd2
1 changed files with 6 additions and 1 deletions

View File

@ -101,6 +101,11 @@ class ServerValidator {
throw new \InvalidArgumentException('server_ip_bad_service');
}
break;
case 'ping':
if(!filter_var($value, FILTER_VALIDATE_IP)) {
throw new \InvalidArgumentException('server_ip_bad_service');
}
break;
}
return true;
@ -113,7 +118,7 @@ class ServerValidator {
* @throws \InvalidArgumentException
*/
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');
}
return true;