mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
48 lines
909 B
PHP
48 lines
909 B
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.2
|
|
*
|
|
* @package phpOMS\Validation\Network
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\Validation\Network;
|
|
|
|
use phpOMS\Validation\ValidatorAbstract;
|
|
|
|
/**
|
|
* Validate hostname.
|
|
*
|
|
* @package phpOMS\Validation\Network
|
|
* @license OMS License 1.0
|
|
* @link https://orange-management.org
|
|
* @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;
|
|
}
|
|
}
|