src/TerminalObject/Helper/Art.php
protected function fileSearch($art, $pattern)
    {
        foreach ($this->art_dirs as $dir) {
            $directory_iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));

            $paths = [];
            $regex = '~' . preg_quote($art) . $pattern . '~';

            foreach ($directory_iterator as $file) {
                if ($file->isDir()) {
                    continue;
                }

                // Look for anything that has the $art filename
                if (preg_match($regex, $file)) {
                    $paths[] = $file->getPathname();
                }
            }

            asort($paths);

            // If we've got one, no need to look any further
            if (!empty($paths)) {
                return $paths;
            }
        }

        return [];
    }
protected function fileSearch($art, $pattern)
    {
        foreach ($this->art_dirs as $dir) {
            $directory_iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));

            $paths = [];
            $regex = '~' . preg_quote($art) . $pattern . '~';

            foreach ($directory_iterator as $file) {
                if ($file->isDir()) {
                    continue;
                }

                // Look for anything that has the $art filename
                if (preg_match($regex, $file)) {
                    $paths[] = $file->getPathname();
                }
            }

            asort($paths);

            // If we've got one, no need to look any further
            if (!empty($paths)) {
                return $paths;
            }
        }

        return [];
    }
protected function fileSearch ( $ art , $ pattern ) { foreach ( $ this -> art_dirs as $ dir ) { $ directory_iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ dir ) ) ; $ paths = [ ] ; $ regex = '~' . preg_quote ( $ art ) . $ pattern . '~' ; foreach ( $ directory_iterator as $ file ) { if ( $ file -> isDir ( ) ) { continue ; } // Look for anything that has the $art filename if ( preg_match ( $ regex , $ file ) ) { $ paths [ ] = $ file -> getPathname ( ) ; } } asort ( $ paths ) ; // If we've got one, no need to look any further if ( ! empty ( $ paths ) ) { return $ paths ; } } return [ ] ; }
Find a set of files in the current art directories
based on a pattern

@param string $art
@param string $pattern

@return array
Find a set of files in the current art directories based on a pattern