app/Http/Controllers/AdminTreesController.php
private function gedcomFiles(string $folder): array
    {
        $d     = opendir($folder);
        $files = [];
        while (($f = readdir($d)) !== false) {
            if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) {
                $fp     = fopen(WT_DATA_DIR . $f, 'rb');
                $header = fread($fp, 64);
                fclose($fp);
                if (preg_match('/^(' . Gedcom::UTF8_BOM . ')?0 *HEAD/', $header)) {
                    $files[] = $f;
                }
            }
        }
        sort($files);

        return $files;
    }
private function gedcomFiles(string $folder): array
    {
        $d     = opendir($folder);
        $files = [];
        while (($f = readdir($d)) !== false) {
            if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) {
                $fp     = fopen(WT_DATA_DIR . $f, 'rb');
                $header = fread($fp, 64);
                fclose($fp);
                if (preg_match('/^(' . Gedcom::UTF8_BOM . ')?0 *HEAD/', $header)) {
                    $files[] = $f;
                }
            }
        }
        sort($files);

        return $files;
    }
private function gedcomFiles ( string $ folder ) : array { $ d = opendir ( $ folder ) ; $ files = [ ] ; while ( ( $ f = readdir ( $ d ) ) !== false ) { if ( ! is_dir ( WT_DATA_DIR . $ f ) && is_readable ( WT_DATA_DIR . $ f ) ) { $ fp = fopen ( WT_DATA_DIR . $ f , 'rb' ) ; $ header = fread ( $ fp , 64 ) ; fclose ( $ fp ) ; if ( preg_match ( '/^(' . Gedcom :: UTF8_BOM . ')?0 *HEAD/' , $ header ) ) { $ files [ ] = $ f ; } } } sort ( $ files ) ; return $ files ; }
Find a list of GEDCOM files in a folder

@param string $folder

@return array
Find a list of GEDCOM files in a folder