Set or remove the fragment part of this URI.

@param string $fragment
@return UriBuilder
2756
public function fragment($fragment)
	{
		$this->fragment = ($fragment === NULL || $fragment == '') ? NULL : (string)$fragment;
		
		return $this;
	}
339160
public function setFragment($fragment = null)
    {
        if (is_string($fragment)) {
            if ($fragment{0} === '#') {
                $fragment = substr($fragment, 1);
            }
        }
        else if (!is_null($fragment)) {
            throw new \InvalidArgumentException(
                "invalid value provided for 'fragment'; ".
                "expecting a string or null"
            );
        }

        $this->fragment = $fragment;
        return $this;
    }
1357417
protected function set($url)
    {
        $parts = parse_url($url);
        if (!$parts) {
            throw new \InvalidArgumentException('URL malformed');
        }

        $this->scheme   = isset($parts['scheme']) ? strtolower($parts['scheme']) : '';
        $this->username = $parts['user'] ?? '';
        $this->password = $parts['pass'] ?? '';
        $this->host     = isset($parts['host']) ? strtolower($parts['host']) : '';
        $this->port     = isset($parts['port']) ? intval($parts['port']) : null;
        $this->path     = $parts['path'] ?? '';
        $this->query    = $parts['query'] ?? '';
        $this->fragment = $parts['fragment'] ?? '';
    }
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;
    }
851239
public function put($key, $fragment)
    {
        $key = $this->normalizeCacheKey($key);

        return $this->cache
            ->tags('views')
            ->rememberForever($key, function () use ($fragment) {
                return $fragment;
            });
    }
1275766
public static <F extends Fragment> FragmentBundler<F> create(F fragment) {
    return new FragmentBundler<F>(fragment);
  }
946070
public function fragment($fragment = null)
    {
        if (is_null($fragment)) return $this->fragment;

        $this->fragment = $fragment;

        return $this;
    }
946648
static function createFromValidFragments(array $fragments) {
    $fqcnStr = '\\' . implode('\\', $fragments);
    $name = end($fragments);
    return new self($fqcnStr, $name);
  }
1119820
public static function filterFragment($fragment)
    {
        if (null === $fragment) {
            $fragment = '';
        }

        if (!empty($fragment) && strpos($fragment, '#') === 0) {
            $fragment = substr($fragment, 1);
        }

        return static::filterQueryOrFragment($fragment);
    }
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);
    }
735631
protected function createUriPointerMap(UriInterface $uri)
    {
        $uri = clone $uri;
        $uri->normalize();
        $map = array(array($uri->toString(), array()));

        $fragmentPointer = $this->pointerFactory()->createFromUri($uri);
        if ($fragmentPointer->hasAtoms()) {
            $atoms = array();
            $fragmentlessUri = clone $uri;
            $fragmentlessUri->setFragment(null);

            while ($fragmentPointer->hasAtoms()) {
                array_unshift($atoms, $fragmentPointer->lastAtom());
                $fragmentPointer = $fragmentPointer->parent();

                $uri = clone $fragmentlessUri;
                $uri->setFragment($fragmentPointer->string());
                $uri->normalize();

                array_unshift($map, array($uri->toString(), $atoms));
            }
        }

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

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

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

        return $this->query($compiler->getSql(), $compiler->getValues());
    }
315753
private function filterFragment(string $fragment)
    {
        if ('' !== $fragment && \strpos($fragment, '#') === 0) {
            $fragment = '%23' . \substr($fragment, 1);
        }

        return $this->filterQueryOrFragment($fragment);
    }
890202
public UriComponentsBuilder fragment(String fragment) {
		if (fragment != null) {
			Assert.hasLength(fragment, "'fragment' must not be empty");
			this.fragment = fragment;
		}
		else {
			this.fragment = null;
		}
		return this;
	}
352958
public function setFragment($fragment)
    {
        if ($this->validateFragment($fragment) === false) {
            include_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment");
        }

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

        return $oldFragment;
    }
938178
protected static function buildUrlMergeUrlParts($parts)
    {
        $partsDefault = array(
            'scheme'    => null,
            'host'      => null,
            'port'      => null,
            'path'      => '/',
            'query'     => '',
            'fragment'  => null,
        );
        if (!empty($parts['url'])) {
            $urlParts = self::parseUrl(htmlspecialchars_decode($parts['url']));
            if (!$urlParts['scheme']) {
                $urlParts['scheme'] = 'omit';
            }
            if (!empty($parts['path'])) {
                // discard url's query and fragment
                $urlParts['query']      = null;
                $urlParts['params']     = array();
                $urlParts['fragment']   = null;
            }
            if ($urlParts['query'] && !empty($parts['query'])) {
                // merge the queries
                $paramsParts = Str::parse($parts['query']);
                $params = ArrayUtil::mergeDeep($urlParts['params'], $paramsParts);
                $parts['query'] = self::buildQueryString($params);
            }
            $partsDefault = array_merge($partsDefault, $urlParts);
        }
        $parts = array_merge($partsDefault, $parts);
        return $parts;
    }