From b10bc66e031beffdfb343789be31c7655b279ea5 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:38:47 +0100 Subject: [PATCH] Add ping validation checks to ServerValidator --- src/psm/Util/Server/ServerValidator.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/psm/Util/Server/ServerValidator.php b/src/psm/Util/Server/ServerValidator.php index 8b23d14f..4c97333f 100644 --- a/src/psm/Util/Server/ServerValidator.php +++ b/src/psm/Util/Server/ServerValidator.php @@ -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;