Añade segmentos a la ruta

@param string[] ...$pieces

@return \PlanB\Type\Path\PathNormalizer
515998
private function collect(string ...$pieces): self
    {
        foreach ($pieces as $piece) {
            $parts = $this->getPartsFromSegment($piece);
            foreach ($parts as $part) {
                $this->add($part);
            }
        }

        return $this;
    }
696932
public static function joinPaths(...$parts)
    {
        $combined = null;
        $parts = array_filter($parts);
        array_walk_recursive($parts, function ($part) use (&$combined) {
            // Normalise path
            $part = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $part);
            $combined = $combined
                ? (rtrim($combined, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $part)
                : $part;
        });
        return $combined;
    }
25540
private function getRecursivelyParam($param, array $pieces)
    {
        if (0 === count($pieces)) {
            return $param;
        }

        $key = array_shift($pieces);
        if (false === isset($param[$key])) {
            return;
        }

        return $this->getRecursivelyParam($param[$key], $pieces);
    }
1237564
private static function recursiveImplode($glue, $pieces)
    {
        if (is_array($pieces)) {
            $strings = array();
            foreach ($pieces as $key => $piece) {
                if (is_int($key) || $key !== self::ATTRIBUTES) {
                    if (is_array($piece)) {
                        $strings[$key] = static::recursiveImplode($glue, $piece);
                    } else {
                        $strings[$key] = (string) $piece;
                    }
                }
            }
            return implode($glue, $strings);
        } else {
            return (string) $pieces;
        }
    }
1014694
public function append(string ...$pieces): self
    {
        $piece = implode($pieces);

        return self::make(sprintf('%s%s', $this->text, $piece));
    }
880523
protected function buildApprovalPath(string ...$parts)
    {
        return static::buildPath('repositories', $this->username, $this->repo, 'commit', $this->commit, 'approve', ...$parts);
    }
1094536
final public function createAbstractClazzFromStringArray(array $parts) : AbstractClazz
    {
        return new AbstractClazz(
            $this->extractClazzPart($parts),
            new Namespaze($this->extractNamespaceParts($parts))
        );
    }
994422
protected function marshalInstance(array $parts)
    {
        $this->scheme = array_key_exists('scheme', $parts)
            ? $this->marshalScheme($parts['scheme'])
            : ''
        ;

        $this->userInfo = $parts['user'] ?? null;

        if ( array_key_exists('pass', $parts) ) {
            $this->userInfo .= ':'.$parts['pass'];
        }

        $this->host = array_key_exists('host', $parts)
            ? $this->marshalHost($parts['host'])
            : $this->host
        ;

        $this->port = array_key_exists('port', $parts)
            ? $this->marshalPort($parts['port'])
            : null
        ;

        $this->path = array_key_exists('path', $parts)
            ? $this->marshalPath($parts['path'])
            : '/'
        ;

        $this->query = array_key_exists('query', $parts)
            ? $this->marshalQueryAndFragment($parts['query'])
            : null
        ;

        $this->fragment = array_key_exists('fragment', $parts)
            ? $this->marshalQueryAndFragment($parts['fragment'])
            : null
        ;

        if ( empty($this->scheme) && ! array_key_exists('host', $parts) && ! array_key_exists('port', $parts) ) {
            $this->scheme = 'http';
        }

        $this->calibratePort();
    }
1234869
public static function fromArray(array $pathParts)
    {
        if (0 === count($pathParts)) {
            $path = '';
        } else {
            $pathParts = self::escape($pathParts);
            $path = '/'.implode('/', $pathParts);
        }

        return new static($path);
    }
7812
protected static function buildPath(string ...$parts)
    {
        $parts = array_map(function (string $part) {
            if (!$part) {
                throw new InvalidArgumentException('Missing required parameter.');
            }

            return self::urlEncode($part);
        }, $parts);

        return implode('/', $parts);
    }
340664
protected function segmentMatches($urlSegment, $pathSegment)
    {
        $result = false;
        $realUrlSegment = $urlSegment;

        foreach ($this->getUrlSegmentVoters() as $urlSegmentVoter) {
            $urlSegmentVoter->setUrlSegment($urlSegmentVoter->transformSegment($urlSegment));
            $urlSegmentVoter->setPathSegment($pathSegment);

            if ($urlSegmentVoter->vote() === VoteResult::NO) {
                $result = false;
            }

            if ($urlSegmentVoter->vote() === VoteResult::YES) {
                $result = true;
                $realUrlSegment = $urlSegmentVoter->transformSegment($urlSegment);
            }
        }

        return $result ? $realUrlSegment : false;
    }
1299596
static function implodeRecursive($glue, $pieces)
    {
        $items = [];
        foreach ($pieces as $item){
            if (is_array($item)){
                $items[] = self::implodeRecursive($glue, $item);
            }else{
                $items[] = $item;
            }
        }
        return implode($glue, $items);
    }
54996
public static function buildUrl(array $parts)
    {
        $scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : '';
        $host = isset($parts['host']) ? $parts['host'] : '';
        $port = isset($parts['port']) ? ':' . $parts['port'] : '';
        $user = isset($parts['user']) ? $parts['user'] : '';
        $pass = isset($parts['pass']) ? ':' . $parts['pass'] : '';
        $pass = ($user || $pass) ? "$pass@" : '';
        $path = isset($parts['path']) ? $parts['path'] : '';
        $query = isset($parts['query']) ? '?' . $parts['query'] : '';
        $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
        return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
    }
552741
protected function buildCommentsPath(string ...$parts)
    {
        return static::buildPath('repositories', $this->username, $this->repo, 'pullrequests', $this->pr, 'comments', ...$parts);
    }
1017501
private function configureSlashPrefix(array $pieces): self
    {
        $first = array_shift($pieces);

        $pattern = sprintf('#^%s#', DIRECTORY_SEPARATOR);
        if (preg_match($pattern, $first)) {
            $this->prefix .= DIRECTORY_SEPARATOR;
        }

        return $this;
    }
332506
public static function normalizePath($path)
    {
        if (isset(self::$normalizePath[$path])) {
            return self::$normalizePath[$path];
        }

        $path = \str_replace('\\', '/', $path);
        $path = static::removeFunkyWhiteSpace($path);

        $parts = [];

        foreach (\explode('/', $path) as $part) {
            switch ($part) {
                case '':
                case '.':
                    break;

                case '..':
                    if (empty($parts)) {
                        throw new \LogicException('Path is outside of the defined root, path: [' . $path . ']');
                    }
                    \array_pop($parts);
                    break;

                default:
                    $parts[] = $part;
                    break;
            }
        }

        return self::$normalizePath[$path] = implode('/', $parts);
    }
518650
public function removeFirstSegments($count) {
		$segments = new ArrayObject();
		for ($i = $count; $i < $this->segmentCount(); $i++) {
			$segments->push($this->segments[$i]);
		}
		return new Path($segments->join('/'));
	}