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

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

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

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

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

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

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

@throws SyntaxError If the host can not be prepended

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