Returns an edge by its path.

@param (string|string[])[] a path

@return Edge

@throws InvalidArgumentException path not found
6158
public function getEdge(array $edge)
    {
        foreach ($this->instructions as $instruction) {
            if (!$instruction instanceof Edge) {
                continue;
            }

            if ($instruction->getList() == $edge) {
                return $instruction;
            }
        }

        $label = implode(' -> ', array_map(function ($edge) {
            if (is_string($edge)) {
                return $edge;
            }

            return implode(':', $edge);
        }, $edge));

        throw new \InvalidArgumentException(sprintf('Found no edge "%s".', $label));
    }
573543
public function path() {
		$args = func_get_args();
		if (count($args)) {
			$this->path = $this->verify($args[0]);
		}
		return $this->path;
	}
550084
public function processMultiplePaths($paths)
    {
        $paths = $this->parseAsArray($paths);
        $paths = array_map([ $this, 'filterPath' ], $paths);
        $paths = array_filter($paths, [ $this, 'pathExists' ]);

        if ($paths === false) {
            throw new InvalidArgumentException('Received invalid paths.');
        }

        if (empty($paths)) {
            throw new InvalidArgumentException('Received empty paths.');
        }

        return $paths;
    }
567891
public function get(string $path, $default = null)
    {
        if ($this->mode === self::MODE_FOLDER) {
            $nodes = Str::toArray($path, $this->separator);
            $name = \array_shift($nodes);// config file name

            // if config file not load. load it.
            if (!isset($this->data[$name])) {
                $file = $this->folderPath . "/{$name}.{$this->format}";

                if (!is_file($file)) {
                    throw new \InvalidArgumentException("The want get config file not exist, Name: $name, File: $file");
                }

                $this->data[$name] = self::read($file, $this->format);
            }
        }

        return parent::get($path, $default);
    }
530492
public function getEdges()
    {
        $this->numEdges = count($this->graph->getVertices());
        if ($this->numEdges < 3) {
            throw new UnderflowException('Needs at least 3 vertices');
        }

        // numEdges 3-12 should work

        $this->bestWeight = $this->upperLimit;
        $this->startVertex = $this->getVertexStart();

        $result = $this->step($this->startVertex,
                              0,
                              array(),
                              array()
                  );

        if ($result === NULL) {
            throw new UnexpectedValueException('No resulting solution for TSP found');
        }

        return new Edges($result);
    }
1013415
public function removeEdge(Edge $edge)
    {
        $id = array_search($edge, $this->edges, true);
        if ($id === false) {
            throw new InvalidArgumentException('Given edge does NOT exist');
        }
        unset($this->edges[$id]);
    }
643658
protected function checkPath($path)
    {
        // provide compatibility with objects such as \SplFileInfo
        if (is_object($path) && method_exists($path, '__toString')) {
            $path = (string) $path;
        }

        $handle = @fopen($path, 'r');

        if (false === $handle) {
            throw new InvalidArgumentException(sprintf('File %s does not exist.', $path));
        }

        fclose($handle);

        return $path.'[0]';
    }
1038282
private function findEdges($id, array $arguments, $required, $name)
    {
        $edges = array();
        foreach ($arguments as $argument) {
            if ($argument instanceof Parameter) {
                $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null;
            } elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) {
                $argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null;
            }

            if ($argument instanceof Reference) {
                if (!$this->container->has((string) $argument)) {
                    $this->nodes[(string) $argument] = array('name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']);
                }

                $edges[] = array('name' => $name, 'required' => $required, 'to' => $argument);
            } elseif (is_array($argument)) {
                $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name));
            }
        }

        return $edges;
    }
558578
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        $clone = clone $this;
        $clone->path = Validator::checkPath($path);

        // if the path is absolute, then clear basePath
        if (substr($path, 0, 1) == '/') {
            $clone->basePath = '';
        }

        return $clone;
    }
227014
public function get ($path) {
		list ($first, $rest) = self::getFirstAndRestPathElements($path);

		if (array_key_exists($first, $this -> data)) {
			$value = $this -> data[$first];
			if (is_null($rest)) {
				return $value;
			} else if ($value instanceof TreeInterface) {
				return $value -> get($rest);
			} else {
				throw new InvalidKeyException("Value at key `" . $first . "` is a scalar; cannot step further down the requested path `" . $rest . "`");
			}
		} else {
			throw new NonExistentKeyException("Key `" . $first . "` does not exist.");
		}
	}
756358
static <T> GraphTraversal<T, Edge> isEdge(GraphTraversal<T, ? extends Element> traversal) {
        // This cast is safe because we filter only to edges
        //noinspection unchecked
        return (GraphTraversal<T, Edge>) traversal.filter(e -> e.get() instanceof Edge);
    }
1131647
public function makePathRelative($endPath, $startPath)
    {
        if (!$this->isAbsolutePath($startPath)) {
            throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
        }

        if (!$this->isAbsolutePath($endPath)) {
            throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
        }

        // Normalize separators on Windows
        if ('\\' === \DIRECTORY_SEPARATOR) {
            $endPath = str_replace('\\', '/', $endPath);
            $startPath = str_replace('\\', '/', $startPath);
        }

        $stripDriveLetter = function ($path) {
            if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
                return substr($path, 2);
            }

            return $path;
        };

        $endPath = $stripDriveLetter($endPath);
        $startPath = $stripDriveLetter($startPath);

        // Split the paths into arrays
        $startPathArr = explode('/', trim($startPath, '/'));
        $endPathArr = explode('/', trim($endPath, '/'));

        $normalizePathArray = function ($pathSegments) {
            $result = [];

            foreach ($pathSegments as $segment) {
                if ('..' === $segment) {
                    array_pop($result);
                } elseif ('.' !== $segment) {
                    $result[] = $segment;
                }
            }

            return $result;
        };

        $startPathArr = $normalizePathArray($startPathArr);
        $endPathArr = $normalizePathArray($endPathArr);

        // Find for which directory the common path stops
        $index = 0;
        while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
            ++$index;
        }

        // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
        if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
            $depth = 0;
        } else {
            $depth = \count($startPathArr) - $index;
        }

        // Repeated "../" for each level need to reach the common path
        $traverser = str_repeat('../', $depth);

        $endPathRemainder = implode('/', \array_slice($endPathArr, $index));

        // Construct $endPath from traversing to the common path, then to the remaining $endPath
        $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');

        return '' === $relativePath ? './' : $relativePath;
    }
262295
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Invalid path provided; must be a string');
        }
        $path = $this->filterPath($path);

        $new = clone $this;
        $new->path = $path;

        return $new;
    }
402636
@Override
    public Node get(final String path) throws IllegalArgumentException {
        // Precondition checks
        Validate.notNullOrEmpty(path, "No path was specified");

        // Make a Path
        final ArchivePath realPath = new BasicPath(path);

        // Delegate
        return get(realPath);
    }
10883
public function get(string $path, array $row): ?string
    {
        if (!array_key_exists($this->colName, $row) || (null === $row[$this->colName])) {
            return null;
        }
        $content = $this->decode($row[$this->colName]);
        $chunks  = explode('.', $path);

        if (!array_key_exists($chunks[0], $content)) {
            return null;
        }

        if (null === ($extractor = $this->extractors[$chunks[0]] ?? null)) {
            throw new \InvalidArgumentException('Sub extractor ' . $chunks[0] . ' not found');
        }

        switch (true) {
            case $extractor instanceof MultiStringExtractorInterface:
                return $extractor->get(substr($path, (\strlen($chunks[0]) + 1)), $content);
            case $extractor instanceof StringExtractorInterface:
                return $extractor->get($content);
            default:
        }
    }
460185
function() {

            var segments = this.segments;
            var numSegments = segments.length;
            // works even if path has no segments

            var path = new Path();
            for (var i = 0; i < numSegments; i++) {

                var segment = segments[i].clone();
                path.appendSegment(segment);
            }

            return path;
        }
97755
function (path) {
            // edge case
            if (!path) {
                return [];
            }

            // first letter will give the type
            var first = path.charAt(0), closing, part, next, nextParse;

            // case brackets
            if (first == "[") {
                closing = path.indexOf("]");
                if (closing != -1) {
                    part = path.substring(1, closing);
                    next = path.substring(closing + 1);
                    if (/^\d+$/.test(part)) {
                        nextParse = this._paramParse(next);
                        nextParse.unshift(parseInt(part, 10));
                        return nextParse;
                    } else {
                        // check that part is "something" or 'somethingelse'
                        var strMarker = part.charAt(0), utilString = ariaUtilsString;
                        if ((strMarker == "'" || strMarker == '"')
                                && utilString.indexOfNotEscaped(part, strMarker, 1) == part.length - 1) {
                            nextParse = this._paramParse(next);
                            nextParse.unshift(part.substring(1, part.length - 1).replace(new RegExp("\\\\" + strMarker, "gi"), strMarker));
                            return nextParse;
                        }
                    }
                }
            } else if (first == ".") {
                part = /^[_A-z\$]\w*/.exec(path.substring(1));
                if (part.length) {
                    part = part[0];
                    next = path.substring(part.length + 1);
                    nextParse = this._paramParse(next);
                    nextParse.unshift(part);
                    return nextParse;
                }
            }

            // nothing returned -> throws an exception
            throw {
                error : this.WRONG_PATH_SYNTAX,
                args : [path]
            };
        }