public static function ListFilteredFiles( string $folder, $filter, bool $recursive = false ) : array
   {

      // Init the array that should contain the resulting file paths
      $files = array();

      if ( ! \is_dir( $folder ) )
      {
         // No folder = we are done here
         return $files;
      }

      if ( ! $recursive )
      {
         // List only files directly contained inside $folder (none from sub folders)

         // Open the directory pointer
         $d = \dir( $folder );
         while ( false !== ( $entry = $d->read() ) )
         {
            if ( $entry == '.' || $entry == '..' )
            {
               // Ignore . and ..
               continue;
            }
            $tmp = Path::Combine( $folder, $entry );
            if ( ! \is_file( $tmp ) )
            {
               continue;
            }
            if ( \is_callable( $filter ) )
            {
               if ( \call_user_func( $filter, $entry, $tmp ) )
               {
                  $files[] = $tmp;
               }
               continue;
            }
            try
            {
               if ( ! \preg_match( $filter, $entry ) )
               {
                  continue;
               }
               $files[] = $tmp;
            }
            catch ( \Exception $ex ) { $ex = null; }
         }
         $d->close();
         return $files;
      }

      static::_listRecursiveFiltered( $files, $filter, $folder );
      return $files;

   }