Yosymfony\Spress\Core\ContentManager\Permalink\PermalinkGenerator::sanitize PHP Method

sanitize() private method

private sanitize ( $url )
    private function sanitize($url)
    {
        $count = 0;
        if ((new StringWrapper($url))->startWith('/') === false) {
            $url = '/' . $url;
        }
        $result = preg_replace('/\\/\\/+/', '/', $url);
        $result = str_replace(':/', '://', $result, $count);
        if ($result !== '/') {
            $result = rtrim($result, '/');
        }
        if ($count > 1) {
            throw new \UnexpectedValueException(sprintf('Bad URL: "%s".', $result));
        }
        if (false !== strpos($result, ' ')) {
            throw new \UnexpectedValueException(sprintf('Bad URL: "%s". Contain white space/s.', $result));
        }
        return $result;
    }