added a mac validation method.

This commit is contained in:
Marcel Naeve 2016-05-13 15:46:14 +02:00
parent 430efe8978
commit 98fee3a0e0
1 changed files with 11 additions and 1 deletions

View File

@ -59,7 +59,7 @@ class Validate
* @param string $address IP address
* @return bool is the IP Address valid?
*/
static function ip(string $address) : bool
static function ip (string $address) : bool
{
return false !== filter_var($address, FILTER_VALIDATE_IP);
}
@ -84,6 +84,16 @@ class Validate
return false !== filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
}
/**
* Static function for validation a Mac Address.
* @param string $address mac address
* @return bool is the mac valid?
*/
static function mac (string $address) : bool
{
return false !== filter_var($address, FILTER_VALIDATE_MAC);
}
/**
* Static function for validating a number range.
* @param float $value number to validate