Returns the keys for a path.

@param string $path
@param array  $keys

@return array|false
500370
protected function getKeys($path, array $keys)
    {
        if (!$this->has($path)) {
            return false;
        }

        $return = [];
        foreach ($keys as $key) {
            if ($key === 'path') {
                $return[$key] = $path;
                continue;
            }

            $return[$key] = $this->storage[$path][$key];
        }

        return $return;
    }
1267680
public function getMigrationFiles($paths)
    {
        return Collection::make($paths)->flatMap(function ($path) {
            return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php');
        })->filter()->sortBy(function ($file) {
            return $this->getMigrationName($file);
        })->values()->keyBy(function ($file) {
            return $this->getMigrationName($file);
        })->all();
    }
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.");
		}
	}
1046712
protected function getKeyLookup($keys)
	{
		// First pass, create a lookup of the keys.
		$lookup = array();

		foreach ($keys as $key)
		{
			if ($key instanceof \SimpleXMLElement)
			{
				$kName = (string) $key['Index'];
			}
			else
			{
				$kName = $key->Index;
			}

			if (empty($lookup[$kName]))
			{
				$lookup[$kName] = array();
			}

			$lookup[$kName][] = $key;
		}

		return $lookup;
	}
1242343
private static function findRootDir($path, array $roots)
    {
        foreach ($roots as $root) {
            if (0 === strpos($path, $root)) {
                return $root;
            }
        }
    }
875160
public static function extract($path, $items)
    {
        $paths = explode('.', $path);

        foreach ($paths as $value) {
            if (self::iterable($items) && array_key_exists($value, $items)) {
                $items = $items[$value];
            } else {
                return false;
            }
        }

        return $items;
    }
608994
private function matchKeyValue(string $path, array $methods)
    {
        foreach ($methods as $method) {
            $keyValue = $this->keyValueRoutes[$method][$path] ?? null;
            if (!\is_null($keyValue)) {
                list($handler, $extraParams) = $keyValue;

                return new InternalRoute($handler, $extraParams);
            }
        }

        return null;
    }
1159757
private function getClassNameByPath($path)
	{
		foreach ($this->map as $key => $value) {
			if ($value === $path) {
				return $key;
			}
		}
		
		return null;
	}
1293788
protected function parseKeys($keys)
    {
        return collect($keys)->map(function ($key) {
            if (is_string($key) && Str::startsWith($key, '{') && Str::endsWith($key, '}')) {
                $key = constant(WebDriverKeys::class.'::'.strtoupper(trim($key, '{}')));
            }

            if (is_array($key) && Str::startsWith($key[0], '{')) {
                $key[0] = constant(WebDriverKeys::class.'::'.strtoupper(trim($key[0], '{}')));
            }

            return $key;
        })->all();
    }
310396
private function parseKeys($keys)
    {
        if (is_string($keys)) {
            if (strpos($keys, '[') !== false) {
                $keys = str_replace(']', '', $keys);
                $keys = explode('[', trim($keys, '['));
            } else {
                $keys = (array) $keys;
            }
        }

        return $keys;
    }
237781
private function getSubPathsByNames(string $path, array $names): array
    {
        $subPaths = [];
        foreach ($names as $name) {
            $subPaths[] = $this->getSubPathByName($path, $name);
        }

        return $subPaths;
    }
1328037
protected function get_by_path(array $path) {
        $node = $this->get(array_shift($path));
        foreach ($path as $key) {
            $node->get($key);
        }
        return $node;
    }
1180888
public function normalizePaths(array $paths)
    {
        $result = array();

        foreach ($paths as $key => $value) {
            // key is locale
            if (is_string($value)) {
                foreach ($this->getBrandingsWithLocale($key) as $branding) {
                    $result[$branding->getName()][$key] = $branding->prefixPath($key, $value);
                }
            }

            // key is branding
            if (is_array($value)) {
                foreach ($value as $locale => $path) {
                    $result[$key][$locale] = $this->getBranding($key)->prefixPath($locale, $path);
                }
            }
        }

        return $result;
    }
521873
private function getPathFromArray($path)
    {
        $paths = array();

        foreach ($path as $unverifiedPath) {
            try {
                // Check if `$unverifiedPath` is optional
                // If it exists, then it's added to the list
                // If it doesn't, it throws an exception which we catch
                if ($unverifiedPath[0] !== '?') {
                    $paths = array_merge($paths, $this->getValidPath($unverifiedPath));
                    continue;
                }
                $optionalPath = ltrim($unverifiedPath, '?');
                $paths = array_merge($paths, $this->getValidPath($optionalPath));

            } catch (FileNotFoundException $e) {
                // If `$unverifiedPath` is optional, then skip it
                if ($unverifiedPath[0] === '?') {
                    continue;
                }
                // Otherwise rethrow the exception
                throw $e;
            }
        }

        return $paths;
    }
128282
private static function retrieveFilesFromPaths(array $paths): iterable
    {
        if ([] === $paths) {
            return [];
        }

        $pathsToSearch = [];
        $filesToAppend = [];

        foreach ($paths as $path) {
            if (false === file_exists($path)) {
                throw new RuntimeException(
                    sprintf(
                        'Could not find the file "%s".',
                        $path
                    )
                );
            }

            if (is_dir($path)) {
                $pathsToSearch[] = $path;
            } else {
                $filesToAppend[] = $path;
            }
        }

        $finder = new Finder();

        $finder->files()
            ->in($pathsToSearch)
            ->append($filesToAppend)
            ->filter(static function (SplFileInfo $fileInfo): ?bool {
                if ($fileInfo->isLink()) {
                    return false;
                }

                return null;
            })
            ->sortByName()
        ;

        return $finder;
    }
325046
public function getRoutes(bool $keys = false): array
    {
        return $keys
            ? array_keys($this->_routes)
            : $this->_routes;
    }
664550
protected function getWildcardKeys($data, array $keys) {
        $values = [];

        if ( ! is_array($data) && ! $data instanceof Traversable) {
            if ($data instanceof IArrayable) {
                $data = $data->toArray();
            }

            if ( ! is_array($data)) {
                $data = [];
            }
        }

        foreach ($data as $itemKey => $itemValue) {
            $values[$itemKey] = $itemKey;
        }

        return $values;
    }