Get Folder/File using path.

@param string $path   Path
@param string $itemId Id of the root folder (optional)

@return array
488998
public function getItemByPath(string $path, string $itemId = ''):array
    {
        if (empty($itemId)) {
            return $this->get("Items/ByPath?Path={$path}");
        } else {
            return $this->get("Items({$itemId})/ByPath?Path={$path}");
        }
    }
388716
private String pathToItem(String id) {
		return subDirForId(id) + UNIX_PATH_SEPERATOR + id.substring(SUBDIR_POLICY);
	}
233900
public function findByFolderId($folderId)
    {
        $qb = $this->createQueryBuilder();

        $qb->field('mediaFolder.id')->equals($folderId);

        return $qb->getQuery()->execute();
    }
170991
public function getDirectory($path)
    {
        $subDirectory = new self($this->getFileSystemId(), $this->getFullPath($path));
        $subDirectory->setServiceLocator($this->getServiceLocator());
        return $subDirectory;
    }
282769
public function pathGetOr( $path, $default )
	{
		$path = $this->createPath($path);
		if( $path[0] == 1 )
		{
			return $this->get($path[1]);
		}

		$array = & $this->items;
		for( $i = 1, $len = $path[0]; $i <= $len; $i++ )
		{
			$key = $path[$i];
			if( ! array_key_exists($key, $array) )
			{
				break;
			}

			if( $i == $len )
			{
				return $array[$key];
			}

			if( !isset($array[$key]) || !is_array($array[$key]) )
			{
				break;
			}

			$array = & $array[$key];
		}

		return $default;
	}
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;
    }
977787
public function getItem($itemId)
	{
		if (isset($this->info['data'][$itemId]))
		{
			return $this->info['data'][$itemId];
		}

		return null;
	}
608367
public function getFolder($path = '')
    {
        if (!array_key_exists($path,$this->folders)) {

            $this->folders[$path] = false;

            $url = 'files';
            $path = trim($path, '/');
            if ($path != '') {
                $url .= '/' . $path;
            }

            $response = $this->getClient()->get($url);
            $json = $response->json();

            if ($json) {

                if ($this->publicUrl != false) {
                    $files = [];
                    foreach ($json['files'] as $file) {
                        $file['urls']['default'] = $this->publicUrl . '/' . $file['id'];
                        $files[] = $file;
                    }
                    $json['files'] = $files;
                }
                $folder = new Folder($path, $json);


                $this->folders[$path] = $folder;
            }

        }

        return $this->folders[$path];
    }
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;
    }
1270214
public function getFolder($path = '')
    {
        $this->connect();

        $path = trim($path, '/');

        if (file_exists($this->scheme . '/' . $path))
        {

            $result = [ 'folders' => $this->listSubFolder($path), 'files' => $this->listFiles($path) ];

            $folder = new Folder($path, $result);

            return $folder;
        }

        return false;
    }
416578
public function scanDir($path, $fileOrDirs = self::ALL, $recursive = true)
    {
        $files = scandir($path);

        $path = $this->stripPathLastDirectorySeparator($path);

        $allFiles = [];
        foreach ($files as $file) {
            if ($file !== '.' && $file !== '..') {
                $pathToScan = $path . DIRECTORY_SEPARATOR . $file;
                if (is_dir($pathToScan)) {
                    if ($recursive) {
                        $moreFiles = $this->scanDir($pathToScan, $fileOrDirs, true);
                        $appendParents = function ($path) use ($file) {
                            return $file . DIRECTORY_SEPARATOR . $path;
                        };
                        $moreFiles = array_map($appendParents, $moreFiles);
                        $allFiles = array_merge($allFiles, $moreFiles);
                    }
                    if ($fileOrDirs & self::DIRS) {
                        $allFiles[] = (string) $file;
                    }
                } else {
                    if ($fileOrDirs & self::FILES) {
                        $allFiles[] = (string) $file;
                    }
                }
            }
        }

        return $allFiles;
    }
1078516
private function getFolderById(int $folderId): \stdClass
    {
        $folder = Craft::$app->assets->getFolderById($folderId);
        if ($folder) {
            $volume = $folder->getVolume();
            return  (object) [
                'id' => $folderId,
                'handle' => $volume->handle
            ];
        }
        return null;
    }
567176
private static function getPathFiles(array $path): array
    {
        // load external files
        $result = [];
        $pathFinder = Finder::findFiles('*')->in($path);
        foreach ($pathFinder as $file) {
            $result[$file->getRealPath()] = $file->getBaseName();
        }
        return $result;
    }
1220375
protected function getPath($path)
    {
        $pathsFile = __DIR__.'/../../../../../config/rinvex.composable.php';
        $paths = file_exists($pathsFile) ? require $pathsFile : [];

        return $paths[$path] ?? __DIR__.$this->paths[$path];
    }
970858
public function get_folder_items($folderid = 0) {
        $this->reset_state();
        $result = $this->request($this->make_url("/folders/$folderid/items",
            array('fields' => 'id,name,type,modified_at,size,owned_by')));
        return json_decode($result);
    }
1221649
public function getPath($path)
    {
        if (! is_array($path)) {
            $path = [$path];
        }

        $search_for = [
            '%BASE',
            '%STORAGE',
        ];

        $replace_by = [
            base_path(),
            storage_path(),
        ];

        if (function_exists('app_path')) {
            $search_for[] = '%APP';
            $replace_by[] = app_path();
        }

        if (function_exists('public_path')) {
            $search_for[] = '%PUBLIC';
            $replace_by[] = public_path();
        }

        $folders = str_replace($search_for, $replace_by, $path);

        foreach ($folders as $k => $v) {
            $folders[$k] = realpath($v);
        }

        return $folders;
    }
74615
public function getChild($path)
    {
        if (is_string($path)) {
            $path = explode('/', $path);
        }
        $remaining = array_splice($path, 1, count($path) - 1);

        foreach ($this->childItems as $childItem) {
            if ($childItem->getId() == $path[0]) {
                if (empty($remaining)) {
                    return $childItem;
                } elseif ($childItem instanceof ParentItem) {
                    return $childItem->getChild($remaining);
                } else {
                    return null;
                }
            }
        }

        return null;
    }