public static function appendLabel($uri, $label)
    {
        $host = new Host(self::filterUri($uri)->getHost());
        if ($host->isDomain()) {
            return $uri->withHost((string) (new Domain($host))->append($label));
        }

        if ($host->isIpv4()) {
            $label = ltrim((string) new Host($label), '.');

            return $uri->withHost((string) $host->withContent($host->getContent().'.'.$label));
        }

        throw new SyntaxError(sprintf('The URI host %s can not be appended', (string) $host));
    }
public static function appendLabel($uri, $label)
    {
        $host = new Host(self::filterUri($uri)->getHost());
        if ($host->isDomain()) {
            return $uri->withHost((string) (new Domain($host))->append($label));
        }

        if ($host->isIpv4()) {
            $label = ltrim((string) new Host($label), '.');

            return $uri->withHost((string) $host->withContent($host->getContent().'.'.$label));
        }

        throw new SyntaxError(sprintf('The URI host %s can not be appended', (string) $host));
    }
public static function appendLabel ( $ uri , $ label ) { $ host = new Host ( self :: filterUri ( $ uri ) -> getHost ( ) ) ; if ( $ host -> isDomain ( ) ) { return $ uri -> withHost ( ( string ) ( new Domain ( $ host ) ) -> append ( $ label ) ) ; } if ( $ host -> isIpv4 ( ) ) { $ label = ltrim ( ( string ) new Host ( $ label ) , '.' ) ; return $ uri -> withHost ( ( string ) $ host -> withContent ( $ host -> getContent ( ) . '.' . $ label ) ) ; } throw new SyntaxError ( sprintf ( 'The URI host %s can not be appended' , ( string ) $ host ) ) ; }
Append a label or a host to the current URI host.

@throws SyntaxError If the host can not be appended

@return Psr7UriInterface|UriInterface
Append a label or a host to the current URI host .