0

Final Class Yiisoft\Router\Internal\HostNormalizer

InheritanceYiisoft\Router\Internal\HostNormalizer

Public Methods

Hide inherited methods

Method Description Defined By
normalize() Yiisoft\Router\Internal\HostNormalizer

Method Details

Hide inherited methods

normalize() public static method

public static string[] normalize ( string[] $hosts )
$hosts string[]

                public static function normalize(array $hosts): array
{
    $result = [];
    foreach ($hosts as $host) {
        $host = rtrim($host, '/');
        if ($host !== '' && !in_array($host, $result, true)) {
            $result[] = $host;
        }
    }
    return $result;
}