Set all fragments, adding null fragments if needed.

@param array<integer|null> $fragments

@return static a new instance.
548370
public function withFragments(array $fragments)
    {
        $res = clone $this;

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

        return $res;
    }
756274
public function setTags($tags)
    {
        $this->tags = [];
        $this->ref = null;

        if (is_array($tags)) {
            foreach ($tags as $tag) {
                $this->addTag($tag);
            }
        } else {
            $this->addTag($tags);
        }

        return $this;
    }
1023653
public function setScopes(array $scopes = null)
    {
        ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes);

        $this->scopes = $scopes;

        return $this;
    }
203376
public static function createFromComponents(array $components = []): self
    {
        $components += [
            'scheme' => null, 'user' => null, 'pass' => null, 'host' => null,
            'port' => null, 'path' => '', 'query' => null, 'fragment' => null,
        ];

        return new self(
            $components['scheme'],
            $components['user'],
            $components['pass'],
            $components['host'],
            $components['port'],
            $components['path'],
            $components['query'],
            $components['fragment']
        );
    }
1287100
protected function lexFragment(): FragmentNodeInterface
    {
        $start = $this->lexer->getToken();

        $this->expect(TokenKindEnum::SPREAD);

        $token = $this->lexer->getToken();

        if (KeywordEnum::ON !== $token->getValue() && $this->peek(TokenKindEnum::NAME)) {
            return new FragmentSpreadNode(
                $this->lexFragmentName($token),
                $this->lexDirectives(),
                null,
                $this->createLocation($start)
            );
        }

        if (KeywordEnum::ON === $token->getValue()) {
            $this->lexer->advance();
            $typeCondition = $this->lexNamedType();
        }

        return new InlineFragmentNode(
            $typeCondition ?? null,
            $this->lexDirectives(),
            $this->lexSelectionSet(),
            $this->createLocation($start)
        );
    }
1054797
public function setAliases($aliases)
    {
        if (!is_array($aliases) && !$aliases instanceof \Traversable) {
            throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
        }

        foreach ($aliases as $alias) {
            $this->validateName($alias);
        }

        $this->aliases = $aliases;

        return $this;
    }
510079
public function addAll(array $elements) : Set
    {
        $this->elements = self::sanitize(array_merge($this->elements, $elements));

        return $this;
    }
50559
public function withFragment($fragment)
    {
        if (!is_string($fragment) && !method_exists($fragment, '__toString')) {
            throw new InvalidArgumentException('Uri fragment must be a string');
        }
        $fragment = ltrim((string)$fragment, '#');
        $clone = clone $this;
        $clone->fragment = Validator::checkQuery($fragment);

        return $clone;
    }
972903
public function setFrequencies($frequencies)
    {
        $this->frequencies = $frequencies;
        foreach ($this->frequencies as $frequency) {
            $frequency->setBlock($this);
        }

        return $this;
    }
234307
public function fragment($fragment = null)
    {
        if (func_num_args() === 0) {
            return $this->_fragment;
        }
        $this->_fragment = $fragment;
        return $this;
    }
503931
public function addAll($elements)
    {
        if ($elements instanceof CollectionInterface) {
            $elements = $elements->toArray();
        } else {
            $elements = array_values($elements);
        }
        $this->elements = array_merge($this->elements, $elements);
        return $this;
    }
1219235
public function setDomains($domains)
    {
        if (is_array($domains)) {
            foreach ($domains as $domain) {
                $this->setDomains($domain);
            }
            return $this;
        }

        $this->domains[] = $domains;

        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);
    }
239053
public function reset($items = null)
    {
        $this->items = [];
        if ((func_get_args() > 0) && is_array($items)) {
            $this->items = $items;
        }
        return $this;
    }
659765
function (fragment) {
            var self = this;
            if (S.startsWith(fragment, '#')) {
                fragment = fragment.slice(1);
            }
            self.fragment = fragment;
            return self;
        }
807538
public function setComponents($components)
    {
        $this->components = Collection::make($components);
        foreach ($components as $component) {
            $component->attachTo($this);
        }
        return $this;
    }
829597
protected function _filterFragment($fragment)
    {
        if (! empty($fragment) && strpos($fragment, '#') === 0) {
            $fragment = substr($fragment, 1);
        }

        return $this->_filterQueryOrFragment($fragment);
    }