src/Hostname.php
public function withTld(string $tld): HostnameInterface
    {
        if (!self::myValidateTld($tld, $error)) {
            throw new HostnameInvalidArgumentException($error);
        }

        // Normalize top-level domain.
        self::myNormalizeTld($tld);

        return new self($this->myDomainParts, $tld);
    }
public function withTld(string $tld): HostnameInterface
    {
        if (!self::myValidateTld($tld, $error)) {
            throw new HostnameInvalidArgumentException($error);
        }

        // Normalize top-level domain.
        self::myNormalizeTld($tld);

        return new self($this->myDomainParts, $tld);
    }
public function withTld ( string $ tld ) : HostnameInterface { if ( ! self :: myValidateTld ( $ tld , $ error ) ) { throw new HostnameInvalidArgumentException ( $ error ) ; } // Normalize top-level domain. self :: myNormalizeTld ( $ tld ) ; return new self ( $ this -> myDomainParts , $ tld ) ; }
Returns a copy of the Hostname instance with the specified top-level domain.

@since 1.0.0

@param string $tld The top-level domain.

@throws HostnameInvalidArgumentException If the top-level domain parameter is not a valid top-level domain.

@return HostnameInterface The Hostname instance.
Returns a copy of the Hostname instance with the specified top - level domain .