Return lexicon entries
@return array
@param $path string
422950
function lexicon($path) {
		$lex=array();
		foreach ($this->languages?:explode(',',$this->fallback) as $lang)
			foreach ($this->split($path) as $dir)
				if ((is_file($file=($base=$dir.$lang).'.php') ||
					is_file($file=$base.'.php')) &&
					is_array($dict=require($file)))
					$lex+=$dict;
				elseif (is_file($file=$base.'.ini')) {
					preg_match_all(
						'/(?<=^|\n)(?:'.
							'\[(?<prefix>.+?)\]|'.
							'(?<lval>[^\h\r\n;].*?)\h*=\h*'.
							'(?<rval>(?:\\\\\h*\r?\n|.+?)*)'.
						')(?=\r?\n|$)/',
						$this->read($file),$matches,PREG_SET_ORDER);
					if ($matches) {
						$prefix='';
						foreach ($matches as $match)
							if ($match['prefix'])
								$prefix=$match['prefix'].'.';
							elseif (!array_key_exists(
								$key=$prefix.$match['lval'],$lex))
								$lex[$key]=trim(preg_replace(
									'/\\\\\h*\r?\n/','',$match['rval']));
					}
				}
		return $lex;
	}
352620
private function findFeatureFiles($path)
    {
        $absolutePath = $this->findAbsolutePath($path);

        if (!$absolutePath) {
            return array($path);
        }

        if (is_file($absolutePath)) {
            return array($absolutePath);
        }

        $iterator = new RegexIterator(
            new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
                    $absolutePath,
                    RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS
                )
            ),
            '/^.+\.feature$/i',
            RegexIterator::MATCH
        );

        $paths = array_map('strval', iterator_to_array($iterator));
        uasort($paths, 'strnatcasecmp');

        return $paths;
    }
348685
private function selection(string $path) : array
    {
        $modules = $this->getModules($path);
        if (empty($modules)) {
            $this->abort('Aborting, system modules not found.');
        }

        $result[] = $this->in('Please select first related module:', $modules);
        $result[] = $this->in('Please select second related module:', $modules);
        while ('y' === $this->in('Would you like to select more modules?', ['y', 'n'])) {
            $result[] = $this->in('Please select another related module:', $modules);
        }

        return $result;
    }
942980
public function read($path)
    {
        $location = $this->applyPathPrefix($path);
        return [
            'contents' => $this->ossClient->getObject($this->bucket, $location)
        ];
    }
851009
public function directoryFiles($path)
  {
    $contents = [];

    // Scan directory
    $directoryFiles = scandir($path);

    foreach ($directoryFiles as $index => $filePath)  {

      // Ommit . and ..
      if ( ! in_array($filePath, ['.', '..']))  {

        // Check if this is a directory
        if (is_dir($path . DIRECTORY_SEPARATOR . $filePath)) {

          // Rescan and get files in this directory
          $contents = array_merge($contents, self::directoryFiles($path . DIRECTORY_SEPARATOR . $filePath));

        } else  {

          // Add file to contens array
          $contents[] = $path . DIRECTORY_SEPARATOR . $filePath;
        }
      }
    }

    return $contents;
  }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }
622218
private function lsLegacy(string $path) : array
    {
        $list = [];
        foreach ($this->nlist($path) as $name) {
            $type   = $this->isDir($name) ? 'dir' : 'file';
            $size   = $this->size($name);
            $mtime  = $this->mdtm($name);

            if ($mtime == -1) {
                throw new RuntimeException('FTP server doesnt support \'ftp_mdtm\'');
            }

            $list[] = new File(['name' => $name, 'modify' => $mtime, 'type' => $type, 'size' => $size]);
        }
        return $list;
    }
982824
private static function get_language_plugin_list( $path ) {
		$languages = [];

		// Try to open the given directory.
		$handle = \opendir( $path );
		if ( false === $handle ) {
			// Abort.
			return $languages; // @codeCoverageIgnore
		}

		// Read all files in directory.
		$file = \readdir( $handle );
		while ( $file ) {
			// We only want the JSON files.
			if ( '.json' === \substr( $file, -5 ) ) {
				$file_content = \file_get_contents( $path . $file );
				if ( \preg_match( '/"language"\s*:\s*((".+")|(\'.+\'))\s*,/', $file_content, $matches ) ) {
					$language_name = \substr( $matches[1], 1, -1 );
					$language_code = \substr( $file, 0, -5 );

					$languages[ $language_code ] = $language_name;
				}
			}

			// Read next file.
			$file = \readdir( $handle );
		}
		\closedir( $handle );

		// Sort translated language names according to current locale.
		\asort( $languages );

		return $languages;
	}
763195
private function searchPrefixes($path)
    {
        $dirname = dirname($path);
        $directoryParts = explode(DIRECTORY_SEPARATOR, $dirname);
        $directories = [];
        while ($directoryParts) {
            $directories[] = implode(DIRECTORY_SEPARATOR, $directoryParts);
            array_shift($directoryParts);
        }
        return $directories;
    }
588069
public function getEntry($path)
    {
        $entry = new Entry();
        $path = trim(preg_replace('#/+#', '/', $path), '/');

        if (empty($path)) {
            $entry = new FolderEntry();
            $entry->identity = self::ROOT_DIR_ID;

            return $entry;
        }

        $response = $this->getSearchResponse($path);

        if ($response instanceof SuccessResponse) {
            $entry = $this->getEntryObject($response, $path);
        } elseif ($response instanceof ErrorResponse) {
            throw new \Exception($response->getStatusCode() . (string)$response->getBody());
        }

        return $entry;
    }
406043
public function getList($path = '/') {/*{{{*/

        $rsp = $this->_do_request('GET', $path);

        $list = array();
        if ($rsp) {
            $rsp = explode("\n", $rsp);
            foreach($rsp as $item) {
                @list($name, $type, $size, $time) = explode("\t", trim($item));
                if (!empty($time)) {
                    $type = $type == 'N' ? 'file' : 'folder';
                }

                $item = array(
                    'name' => $name,
                    'type' => $type,
                    'size' => intval($size),
                    'time' => intval($time),
                );
                array_push($list, $item);
            }
        }

        return $list;
    }
1345790
protected function getSegments(string $path): array
    {
        if ('' !== $path && '/' === $path[0]) {
            $path = substr($path, 1);
        }

        return explode('/', $path);
    }
998544
public function getKeys($path)
    {
        if (empty($path)) {
            return array_keys($this->map->getContainer());
        }
        $value = $this->map[$path];
        if (is_array($value)) {
            return array_keys($value);
        } else {
            return false;
        }

    }
808760
public function _pathAsArray($path)
    {
        $result = explode(self::PS, $path);
        // unset empty nodes
        foreach ($result as $key => $item) {
            if (!$item && $item !== "0") {
                unset($result[$key]);
            }
        }
        // re-index array
        $result = array_values($result);
        return $result;
    }
276770
protected function tokenizePath($path)
    {
        $parts = explode($this->pathSeparator, $path);
        if ($this->trimTokens) {
            for ($i = 0; $i < count($parts); $i++) {
                $parts[$i] = trim($parts[$i]);
                if ($parts[$i] === "") {
                    unset($parts[$i]);
                }
            }
        }
        return array_values($parts);
    }
73431
protected function getPhpFiles($path)
    {
        if (is_dir($path)) {
            return new RegexIterator(
                new RecursiveIteratorIterator(
                    new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
                    RecursiveIteratorIterator::SELF_FIRST,
                    RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
                ),
                '/^.+\.php$/i',
                RecursiveRegexIterator::GET_MATCH
            );
        }
        else {
            return [];
        }
    }
1278746
public function getMappingFiles($path)
    {
        $files = $this->files->glob($path.'/*_*.php');

        if ($files === false) {
            return [];
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));
        }, $files);

        return $files;
    }