Vendor/langcode-conv/zendframework/zend-filter/src/UriNormalize.php
protected function enforceScheme(Uri $uri)
    {
        $path = $uri->getPath();
        if (strpos($path, '/') !== false) {
            list($host, $path) = explode('/', $path, 2);
            $path = '/' . $path;
        } else {
            $host = $path;
            $path = '';
        }

        // We have nothing to do if we have no host
        if (!$host) {
            return;
        }

        $uri->setScheme($this->enforcedScheme)
            ->setHost($host)
            ->setPath($path);
    }
protected function enforceScheme(Uri $uri)
    {
        $path = $uri->getPath();
        if (strpos($path, '/') !== false) {
            list($host, $path) = explode('/', $path, 2);
            $path = '/' . $path;
        } else {
            $host = $path;
            $path = '';
        }

        // We have nothing to do if we have no host
        if (!$host) {
            return;
        }

        $uri->setScheme($this->enforcedScheme)
            ->setHost($host)
            ->setPath($path);
    }
protected function enforceScheme ( Uri $ uri ) { $ path = $ uri -> getPath ( ) ; if ( strpos ( $ path , '/' ) !== false ) { list ( $ host , $ path ) = explode ( '/' , $ path , 2 ) ; $ path = '/' . $ path ; } else { $ host = $ path ; $ path = '' ; } // We have nothing to do if we have no host if ( ! $ host ) { return ; } $ uri -> setScheme ( $ this -> enforcedScheme ) -> setHost ( $ host ) -> setPath ( $ path ) ; }
Enforce the defined scheme on the URI

This will also adjust the host and path parts of the URI as expected in
the case of scheme-less network URIs

@param Uri $uri
Enforce the defined scheme on the URI