public function getList(string $path)
    {
        $entity = $this->getEntity($path);

        if (null !== $entity && $entity->file_exists() && $entity->is_dir()) {
            $files = [];
            $changes = $this->getChanges();
            $own = $changes->own($path);

            if (!($entity instanceof VirtualInterface)) {
                $directory = $this->getRoot();
                $directoryPath = $directory->path().'/'.$path;

                $dirHandler = opendir($directoryPath);
                if ($dirHandler) {
                    while (true) {
                        $file = readdir($dirHandler);
                        if (false === $file) {
                            break;
                        } elseif ('.' == $file || '..' == $file) {
                            continue;
                        }

                        $changesKey = ($path ? $path.'/' : '').$file;
                        if (isset($own[$changesKey])) {
                            continue;
                        }
                        $files[$changesKey] = Entity::newInstance($changesKey);
                    }
                    closedir($dirHandler);
                }
            }

            foreach ($own as $changesKey => $file) {
                /* @var $file EntityInterface */
                if ($file instanceof DeletedInterface) {
                    unset($own[$changesKey]);
                }
            }

            $mergedFiles = array_merge($files, $own);
            ksort($mergedFiles);

            $result = array_values($mergedFiles);
        } else {
            $result = null;
        }

        return $result;
    }
public function getList(string $path)
    {
        $entity = $this->getEntity($path);

        if (null !== $entity && $entity->file_exists() && $entity->is_dir()) {
            $files = [];
            $changes = $this->getChanges();
            $own = $changes->own($path);

            if (!($entity instanceof VirtualInterface)) {
                $directory = $this->getRoot();
                $directoryPath = $directory->path().'/'.$path;

                $dirHandler = opendir($directoryPath);
                if ($dirHandler) {
                    while (true) {
                        $file = readdir($dirHandler);
                        if (false === $file) {
                            break;
                        } elseif ('.' == $file || '..' == $file) {
                            continue;
                        }

                        $changesKey = ($path ? $path.'/' : '').$file;
                        if (isset($own[$changesKey])) {
                            continue;
                        }
                        $files[$changesKey] = Entity::newInstance($changesKey);
                    }
                    closedir($dirHandler);
                }
            }

            foreach ($own as $changesKey => $file) {
                /* @var $file EntityInterface */
                if ($file instanceof DeletedInterface) {
                    unset($own[$changesKey]);
                }
            }

            $mergedFiles = array_merge($files, $own);
            ksort($mergedFiles);

            $result = array_values($mergedFiles);
        } else {
            $result = null;
        }

        return $result;
    }
public function getList ( string $ path ) { $ entity = $ this -> getEntity ( $ path ) ; if ( null !== $ entity && $ entity -> file_exists ( ) && $ entity -> is_dir ( ) ) { $ files = [ ] ; $ changes = $ this -> getChanges ( ) ; $ own = $ changes -> own ( $ path ) ; if ( ! ( $ entity instanceof VirtualInterface ) ) { $ directory = $ this -> getRoot ( ) ; $ directoryPath = $ directory -> path ( ) . '/' . $ path ; $ dirHandler = opendir ( $ directoryPath ) ; if ( $ dirHandler ) { while ( true ) { $ file = readdir ( $ dirHandler ) ; if ( false === $ file ) { break ; } elseif ( '.' == $ file || '..' == $ file ) { continue ; } $ changesKey = ( $ path ? $ path . '/' : '' ) . $ file ; if ( isset ( $ own [ $ changesKey ] ) ) { continue ; } $ files [ $ changesKey ] = Entity :: newInstance ( $ changesKey ) ; } closedir ( $ dirHandler ) ; } } foreach ( $ own as $ changesKey => $ file ) { /* @var $file EntityInterface */ if ( $ file instanceof DeletedInterface ) { unset ( $ own [ $ changesKey ] ) ; } } $ mergedFiles = array_merge ( $ files , $ own ) ; ksort ( $ mergedFiles ) ; $ result = array_values ( $ mergedFiles ) ; } else { $ result = null ; } return $ result ; }
Get list of files inside directory path.

@return EntityInterface[]|null
Get list of files inside directory path .