phpOMS/Validation/Network/Hostname.php

48 lines
920 B
PHP

<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @package phpOMS\Validation\Network
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types = 1);
namespace phpOMS\Validation\Network;
use phpOMS\Validation\ValidatorAbstract;
/**
* Validate hostname.
*
* @package phpOMS\Validation\Network
* @license OMS License 1.0
* @link http://website.orange-management.de
* @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;
}
}