@param string $fragment

@return string
163363
protected static function filterFragment($fragment)
    {
        if (! is_string($fragment)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid fragment provided; must be a string argument; received %s',
                (is_object($fragment) ? get_class($fragment) : gettype($fragment))
            ));
        }

        return static::filterQueryOrFragment(ltrim($fragment, '#'));
    }
1259967
private function getRequestPath($url) {
		$urlParts = parse_url($url);
		$path = $urlParts['path'];
		if (isset($urlParts['query'])) {
			$path .= '?' . $urlParts['query'];
		}
		if (isset($urlParts['fragment'])) {
			$path .= '#' . $urlParts['fragment'];
		}
		return $path;
	}
1186082
private function parseCallablePlaceholders($fragment)
    {
        if (strpos($fragment, "{") !== false) {
            foreach ($this->params as $placeholder => $value) {
                if (strpos($fragment, "{" . $placeholder . "}") !== false) {
                    $fragment = str_replace("{" . $placeholder . "}", ucwords(str_replace("-", " ", $value)), $fragment);
                }
            }
        }

        return $fragment;
    }
422684
protected function generateMarkdown( $fragmentLevel = 0 ) {
		$max = 0;
		preg_match_all('/`+/', $this->source, $result, PREG_PATTERN_ORDER);
		if( $result[0] ) {
			$max = max(array_map('\\strlen', $result[0]));
		}

		$quote = str_repeat('`', $max + 1);

		return "{$quote}{$this->source}{$quote}";
	}
887440
public function setFragment(string $fragment = null) : self
    {
        if (is_null($fragment)) {
            unset($this->uri['fragment']);
        } else {
            $this->uri['fragment'] = $fragment;
        }

        return $this;
    }
548370
public function withFragments(array $fragments)
    {
        $res = clone $this;

        $res->fragments = $res->fillArrayInput($fragments);

        return $res;
    }
1368119
protected function setFragment($fragment)
    {
        $this->uriString = null;

        $fragment = ltrim($fragment, '#');

        $this->fragment = static::encode($fragment);

        return $this;
    }
302380
public function executeFragment(FragmentInterface $fragment)
    {
        $compiler = new PgCompiler($this);
        $compiler->compile($fragment);

        return $this->query($compiler->getSql(), $compiler->getValues());
    }
792016
public function setFragment($fragment)
        {
            if ($this->validateFragment($fragment) === false) {
                throw new Exception("Fragment \"$fragment\" is not a valid HTTP fragment");
            }

            $oldFragment     = $this->_fragment;
            $this->_fragment = $fragment;

            return $oldFragment;
        }
315753
private function filterFragment(string $fragment)
    {
        if ('' !== $fragment && \strpos($fragment, '#') === 0) {
            $fragment = '%23' . \substr($fragment, 1);
        }

        return $this->filterQueryOrFragment($fragment);
    }
544140
public function withFragment(string $fragment): URI
    {
        $result = clone $this;
        $result->fragment = $this->filterFragment($fragment);

        return $result;
    }
370952
private function setFragment($fragment)
    {
        $this->fragment = preg_replace_callback(
            '/(?:[^' . self::$charList . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/',
            [$this, 'encode'],
            $fragment
        );

        return $this;
    }
234307
public function fragment($fragment = null)
    {
        if (func_num_args() === 0) {
            return $this->_fragment;
        }
        $this->_fragment = $fragment;
        return $this;
    }
1273127
final protected function buildUrl($fragments)
    {
        // Verify url path
        if (!isset($fragments[0])) {
            throw new InvalidFragmentsParameter('Invalid base url structure, http:// path must exists at position [0]', 1);
        }

        // Cleaning up
        $url = $fragments[0];
        unset($fragments[0]);

        // Begin process for make replacements
        if (isset($fragments[1]) && is_array($fragments[1])) {
            $replacements = [];
            $params = $fragments[1];

            // Add { } to each element of the array
            array_walk($params, function (&$item, $key) use (&$replacements) {
                $replacements['{'.$key.'}'] = $item;
            });
        }

        return str_replace(array_keys($replacements), array_values($replacements), $url);
    }
1282367
private static function isValidUriFragment(?string $fragment): bool
    {
        if ($fragment === null || $fragment === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.5
        // fragment = *( pchar / "/" / "?" )
        // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i',
            'a-z0-9\-._~',
            '!$&\'()*+,;=',
            '%[a-f0-9]{2}'
        );

        return !!preg_match($pattern, $fragment);
    }
1312558
public function parseUrl($url) {
		$url = parse_url($url);
		$url['vars'] = array();
		if (!isset($url['fragment'])) {
			$url['fragment'] = null;
		}
		if (isset($url['query'])) {
			parse_str($url['query'], $url['vars']);
		}

		return $url;
	}
797740
public function addFragment($fragment)
    {
        if (is_array($fragment)) {
            $this->fragments = array_merge($this->fragments, $fragment);
        } else {
            $this->fragments[] = $fragment;
        }
    }