private function findAvailableSubContexts($path, $pattern = '/^.+\.behat\.inc/i')
    {

        if (isset(static::$subContexts[$pattern][$path])) {
            return static::$subContexts[$pattern][$path];
        }

        static::$subContexts[$pattern][$path] = array();

        $fileIterator = new RegexIterator(
            new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($path)
            ),
            $pattern,
            RegexIterator::MATCH
        );
        foreach ($fileIterator as $found) {
            static::$subContexts[$pattern][$path][$found->getRealPath()] = $found->getFileName();
        }

        return static::$subContexts[$pattern][$path];
    }
private function findAvailableSubContexts($path, $pattern = '/^.+\.behat\.inc/i')
    {

        if (isset(static::$subContexts[$pattern][$path])) {
            return static::$subContexts[$pattern][$path];
        }

        static::$subContexts[$pattern][$path] = array();

        $fileIterator = new RegexIterator(
            new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($path)
            ),
            $pattern,
            RegexIterator::MATCH
        );
        foreach ($fileIterator as $found) {
            static::$subContexts[$pattern][$path][$found->getRealPath()] = $found->getFileName();
        }

        return static::$subContexts[$pattern][$path];
    }
private function findAvailableSubContexts ( $ path , $ pattern = '/^.+\.behat\.inc/i' ) { if ( isset ( static :: $ subContexts [ $ pattern ] [ $ path ] ) ) { return static :: $ subContexts [ $ pattern ] [ $ path ] ; } static :: $ subContexts [ $ pattern ] [ $ path ] = array ( ) ; $ fileIterator = new RegexIterator ( new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ path ) ) , $ pattern , RegexIterator :: MATCH ) ; foreach ( $ fileIterator as $ found ) { static :: $ subContexts [ $ pattern ] [ $ path ] [ $ found -> getRealPath ( ) ] = $ found -> getFileName ( ) ; } return static :: $ subContexts [ $ pattern ] [ $ path ] ; }
Find Sub-contexts matching a given pattern located at the passed path.

@param string $path
Absolute path to the directory to search for sub-contexts.
@param string $pattern
File pattern to match. Defaults to `/^.+\.behat\.inc/i`.

@return array
An array of paths.
Find Sub - contexts matching a given pattern located at the passed path .