public static function get_files($dir, $including_dirs = false, $hidden = false, $extension = null)
	{
    $dir = self::clean($dir);
    clearstatcache();
    if ( $dir === './' ){
      $dir = '.';
    }
    if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){
			$files = [];
			$fs = scandir($dir, SCANDIR_SORT_ASCENDING );
      //$encodings = ['UTF-8', 'WINDOWS-1252', 'ISO-8859-1', 'ISO-8859-15'];
			foreach ( $fs as $f ){
				if ( $f !== '.' && $f !== '..' ){
          /*
          $enc = mb_detect_encoding($f, $encodings);
          if ( $enc !== 'UTF-8' ){
            $f = html_entity_decode(htmlentities($f, ENT_QUOTES, $enc), ENT_QUOTES , 'UTF-8');
          }
          */
          if ( $hidden || (strpos(basename($f), '.') !== 0) ){
            if ( $including_dirs ){
              $files[] = self::cur($dir.'/').$f;
            }
            else if ( is_file($dir.'/'.$f) ){
              if ( !$extension || (strtolower($extension) === strtolower(bbn\str::file_ext($f))) ){
                $files[] = self::cur($dir.'/').$f;
              }
            }
          }
				}
			}
      if ( \count($files) > 0 ){
        bbn\x::sort($files);
      }
			return $files;
		}
		return false;
	}
public static function get_files($dir, $including_dirs = false, $hidden = false, $extension = null)
	{
    $dir = self::clean($dir);
    clearstatcache();
    if ( $dir === './' ){
      $dir = '.';
    }
    if ( is_dir($dir) && (($dir === '.') || ((strpos(basename($dir), '.') !== 0) || $hidden)) ){
			$files = [];
			$fs = scandir($dir, SCANDIR_SORT_ASCENDING );
      //$encodings = ['UTF-8', 'WINDOWS-1252', 'ISO-8859-1', 'ISO-8859-15'];
			foreach ( $fs as $f ){
				if ( $f !== '.' && $f !== '..' ){
          /*
          $enc = mb_detect_encoding($f, $encodings);
          if ( $enc !== 'UTF-8' ){
            $f = html_entity_decode(htmlentities($f, ENT_QUOTES, $enc), ENT_QUOTES , 'UTF-8');
          }
          */
          if ( $hidden || (strpos(basename($f), '.') !== 0) ){
            if ( $including_dirs ){
              $files[] = self::cur($dir.'/').$f;
            }
            else if ( is_file($dir.'/'.$f) ){
              if ( !$extension || (strtolower($extension) === strtolower(bbn\str::file_ext($f))) ){
                $files[] = self::cur($dir.'/').$f;
              }
            }
          }
				}
			}
      if ( \count($files) > 0 ){
        bbn\x::sort($files);
      }
			return $files;
		}
		return false;
	}
public static function get_files ( $ dir , $ including_dirs = false , $ hidden = false , $ extension = null ) { $ dir = self :: clean ( $ dir ) ; clearstatcache ( ) ; if ( $ dir === './' ) { $ dir = '.' ; } if ( is_dir ( $ dir ) && ( ( $ dir === '.' ) || ( ( strpos ( basename ( $ dir ) , '.' ) !== 0 ) || $ hidden ) ) ) { $ files = [ ] ; $ fs = scandir ( $ dir , SCANDIR_SORT_ASCENDING ) ; //$encodings = ['UTF-8', 'WINDOWS-1252', 'ISO-8859-1', 'ISO-8859-15']; foreach ( $ fs as $ f ) { if ( $ f !== '.' && $ f !== '..' ) { /*
          $enc = mb_detect_encoding($f, $encodings);
          if ( $enc !== 'UTF-8' ){
            $f = html_entity_decode(htmlentities($f, ENT_QUOTES, $enc), ENT_QUOTES , 'UTF-8');
          }
          */ if ( $ hidden || ( strpos ( basename ( $ f ) , '.' ) !== 0 ) ) { if ( $ including_dirs ) { $ files [ ] = self :: cur ( $ dir . '/' ) . $ f ; } else if ( is_file ( $ dir . '/' . $ f ) ) { if ( ! $ extension || ( strtolower ( $ extension ) === strtolower ( bbn \ str :: file_ext ( $ f ) ) ) ) { $ files [ ] = self :: cur ( $ dir . '/' ) . $ f ; } } } } } if ( \ count ( $ files ) > 0 ) { bbn \ x :: sort ( $ files ) ; } return $ files ; } return false ; }
Returns an array of files contained in the given directory.
Returns the full path of files.

```php
\bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test"));
// (array) ['/home/Docs/Test/file.txt']
\bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test",0,1));
// (array) ['/home/Docs/Test/file.txt', '/home/Docs/Test/.doc.pdf']
\bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test", 1));
// (array) ['/home/Docs/Test/folder', '/home/Docs/Test/file.txt']
\bbn\x::dump(\bbn\file\dir::get_files("/home/Docs/Test", 1,1));
// (array) ['/home/Docs/Test/folder', '/home/Docs/Test/.folder_test','/home/Docs/Test/file.txt', '/home/Docs/Test/.doc.pdf']
```

@param string $dir The directory's path.
@param bool $including_dirs If set to true it will also returns the folders contained in the given directory.
@param bool $hidden If set to true will also returns the hidden files contained the directory
@return array|false
Returns an array of files contained in the given directory . Returns the full path of files .