src/core/framework/core/3rdparty/ezcomponents/Base/src/file.php
static public function findRecursive( $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), &$statistics = null )
    {
        // init statistics array
        if ( !is_array( $statistics ) || !array_key_exists( 'size', $statistics ) || !array_key_exists( 'count', $statistics ) )
        {
            $statistics['size']  = 0;
            $statistics['count'] = 0;
        }

        // create the context, and then start walking over the array
        $context = new ezcBaseFileFindContext;
        self::walkRecursive( $sourceDir, $includeFilters, $excludeFilters, array( 'ezcBaseFile', 'findRecursiveCallback' ), $context );

        // collect the statistics
        $statistics['size'] = $context->size;
        $statistics['count'] = $context->count;

        // return the found and pattern-matched files
        sort( $context->elements );
        return $context->elements;
    }
static public function findRecursive( $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), &$statistics = null )
    {
        // init statistics array
        if ( !is_array( $statistics ) || !array_key_exists( 'size', $statistics ) || !array_key_exists( 'count', $statistics ) )
        {
            $statistics['size']  = 0;
            $statistics['count'] = 0;
        }

        // create the context, and then start walking over the array
        $context = new ezcBaseFileFindContext;
        self::walkRecursive( $sourceDir, $includeFilters, $excludeFilters, array( 'ezcBaseFile', 'findRecursiveCallback' ), $context );

        // collect the statistics
        $statistics['size'] = $context->size;
        $statistics['count'] = $context->count;

        // return the found and pattern-matched files
        sort( $context->elements );
        return $context->elements;
    }
static public function findRecursive ( $ sourceDir , array $ includeFilters = array ( ) , array $ excludeFilters = array ( ) , & $ statistics = null ) { // init statistics array if ( ! is_array ( $ statistics ) || ! array_key_exists ( 'size' , $ statistics ) || ! array_key_exists ( 'count' , $ statistics ) ) { $ statistics [ 'size' ] = 0 ; $ statistics [ 'count' ] = 0 ; } // create the context, and then start walking over the array $ context = new ezcBaseFileFindContext ; self :: walkRecursive ( $ sourceDir , $ includeFilters , $ excludeFilters , array ( 'ezcBaseFile' , 'findRecursiveCallback' ) , $ context ) ; // collect the statistics $ statistics [ 'size' ] = $ context -> size ; $ statistics [ 'count' ] = $ context -> count ; // return the found and pattern-matched files sort ( $ context -> elements ) ; return $ context -> elements ; }
Finds files recursively on a file system

With this method you can scan the file system for files. You can use
$includeFilters to include only specific files, and $excludeFilters to
exclude certain files from being returned. The function will always go
into subdirectories even if the entry would not have passed the filters.
It uses the {@see walkRecursive()} method to do the actually recursion.

Filters are regular expressions and are therefore required to have
starting and ending delimiters. The Perl Compatible syntax is used as
regular expression language.

If you pass an empty array to the $statistics argument, the function
will in details about the number of files found into the 'count' array
element, and the total filesize in the 'size' array element. Because this
argument is passed by reference, you *have* to pass a variable and you
can not pass a constant value such as "array()".

@param string         $sourceDir
@param array(string)  $includeFilters
@param array(string)  $excludeFilters
@param array()        $statistics

@throws ezcBaseFileNotFoundException if the $sourceDir directory is not
a directory or does not exist.
@throws ezcBaseFilePermissionException if the $sourceDir directory could
not be opened for reading.
@return array
Finds files recursively on a file system