src/Generics/Util/Directory.php
public function isEmpty($filter = null): bool
    {
        if (! $this->exists()) {
            throw new DirectoryException("Directory {dir} does not exist", array(
                'dir' => $this->path
            ));
        }
        
        $iter = new \DirectoryIterator($this->path);
        while ($iter->valid()) {
            if (! $iter->isDot() && ($filter === null || ! preg_match("/$filter/", $iter->getFilename()))) {
                return false;
            }
            $iter->next();
        }
        
        return true;
    }
public function isEmpty($filter = null): bool
    {
        if (! $this->exists()) {
            throw new DirectoryException("Directory {dir} does not exist", array(
                'dir' => $this->path
            ));
        }
        
        $iter = new \DirectoryIterator($this->path);
        while ($iter->valid()) {
            if (! $iter->isDot() && ($filter === null || ! preg_match("/$filter/", $iter->getFilename()))) {
                return false;
            }
            $iter->next();
        }
        
        return true;
    }
public function isEmpty ( $ filter = null ) : bool { if ( ! $ this -> exists ( ) ) { throw new DirectoryException ( "Directory {dir} does not exist" , array ( 'dir' => $ this -> path ) ) ; } $ iter = new \ DirectoryIterator ( $ this -> path ) ; while ( $ iter -> valid ( ) ) { if ( ! $ iter -> isDot ( ) && ( $ filter === null || ! preg_match ( "/$filter/" , $ iter -> getFilename ( ) ) ) ) { return false ; } $ iter -> next ( ) ; } return true ; }
Checks whether directory is empty or not

@param string $filter
The filter for entries to skip

@return bool

@throws DirectoryException
Checks whether directory is empty or not