mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 09:10:08 +02:00
- List will be auto-updated from https://publicsuffix.org/list/public_suffix_list.dat - Updated AbstractSearcher rules to be case insensitive - Updated PR creator bots - Docs and tests
38 lines
709 B
PHP
38 lines
709 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use Respect\Validation\Helpers\DomainInfo;
|
|
|
|
use function array_pop;
|
|
use function explode;
|
|
|
|
final class PublicDomainSuffix extends AbstractSearcher
|
|
{
|
|
/**
|
|
* @var string[]
|
|
*/
|
|
private $domainInfo;
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
protected function getDataSource($input = null): array
|
|
{
|
|
$parts = explode('.', $input);
|
|
$tld = array_pop($parts);
|
|
|
|
$domainInfo = new DomainInfo($tld);
|
|
$this->domainInfo = $domainInfo->getPublicSuffixes();
|
|
|
|
return $this->domainInfo;
|
|
}
|
|
}
|