phpOMS/Validation/Network/Hostname.php
2017-10-14 18:03:25 +02:00

50 lines
912 B
PHP

<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace phpOMS\Validation\Network;
use phpOMS\Validation\ValidatorAbstract;
/**
* Validator abstract.
*
* @category Validation
* @package Framework
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
abstract class Hostname extends ValidatorAbstract
{
/**
* Constructor.
*
* @since 1.0.0
* @codeCoverageIgnore
*/
private function __construct()
{
}
/**
* {@inheritdoc}
*/
public static function isValid($value, array $constraints = null) : bool
{
return filter_var(gethostbyname($value), FILTER_VALIDATE_IP) !== false;
}
}