Vendor/langcode-conv/zendframework/zend-filter/src/UriNormalize.php
public function filter($value)
    {
        if (!is_scalar($value)) {
            return $value;
        }
        $value = (string) $value;

        $defaultScheme = $this->defaultScheme ?: $this->enforcedScheme;

        // Reset default scheme if it is not a known scheme
        if (!UriFactory::getRegisteredSchemeClass($defaultScheme)) {
            $defaultScheme = null;
        }

        try {
            $uri = UriFactory::factory($value, $defaultScheme);
            if ($this->enforcedScheme && (!$uri->getScheme())) {
                $this->enforceScheme($uri);
            }
        } catch (UriException $ex) {
            // We are unable to parse / enfore scheme with the given config and input
            return $value;
        }

        $uri->normalize();

        if (!$uri->isValid()) {
            return $value;
        }

        return $uri->toString();
    }
public function filter($value)
    {
        if (!is_scalar($value)) {
            return $value;
        }
        $value = (string) $value;

        $defaultScheme = $this->defaultScheme ?: $this->enforcedScheme;

        // Reset default scheme if it is not a known scheme
        if (!UriFactory::getRegisteredSchemeClass($defaultScheme)) {
            $defaultScheme = null;
        }

        try {
            $uri = UriFactory::factory($value, $defaultScheme);
            if ($this->enforcedScheme && (!$uri->getScheme())) {
                $this->enforceScheme($uri);
            }
        } catch (UriException $ex) {
            // We are unable to parse / enfore scheme with the given config and input
            return $value;
        }

        $uri->normalize();

        if (!$uri->isValid()) {
            return $value;
        }

        return $uri->toString();
    }
public function filter ( $ value ) { if ( ! is_scalar ( $ value ) ) { return $ value ; } $ value = ( string ) $ value ; $ defaultScheme = $ this -> defaultScheme ? : $ this -> enforcedScheme ; // Reset default scheme if it is not a known scheme if ( ! UriFactory :: getRegisteredSchemeClass ( $ defaultScheme ) ) { $ defaultScheme = null ; } try { $ uri = UriFactory :: factory ( $ value , $ defaultScheme ) ; if ( $ this -> enforcedScheme && ( ! $ uri -> getScheme ( ) ) ) { $ this -> enforceScheme ( $ uri ) ; } } catch ( UriException $ ex ) { // We are unable to parse / enfore scheme with the given config and input return $ value ; } $ uri -> normalize ( ) ; if ( ! $ uri -> isValid ( ) ) { return $ value ; } return $ uri -> toString ( ) ; }
Filter the URL by normalizing it and applying a default scheme if set

@param  string $value
@return string
Filter the URL by normalizing it and applying a default scheme if set