src/ComposerConfigurator.php
protected function pregGrepRecursive($pattern, $haystack)
    {
        $matches = [];
        
        foreach ($haystack as $key => $item) {
            if (is_array($item)) {
                $sub_matches = $this->pregGrepRecursive($pattern, $item);
                
                if ($sub_matches) {
                    $matches[$key] = $sub_matches;
                }
            } elseif (preg_match($pattern, $item)) {
                $matches[$key] = $item;
            }
        }
        
        return $matches;
    }
protected function pregGrepRecursive($pattern, $haystack)
    {
        $matches = [];
        
        foreach ($haystack as $key => $item) {
            if (is_array($item)) {
                $sub_matches = $this->pregGrepRecursive($pattern, $item);
                
                if ($sub_matches) {
                    $matches[$key] = $sub_matches;
                }
            } elseif (preg_match($pattern, $item)) {
                $matches[$key] = $item;
            }
        }
        
        return $matches;
    }
protected function pregGrepRecursive ( $ pattern , $ haystack ) { $ matches = [ ] ; foreach ( $ haystack as $ key => $ item ) { if ( is_array ( $ item ) ) { $ sub_matches = $ this -> pregGrepRecursive ( $ pattern , $ item ) ; if ( $ sub_matches ) { $ matches [ $ key ] = $ sub_matches ; } } elseif ( preg_match ( $ pattern , $ item ) ) { $ matches [ $ key ] = $ item ; } } return $ matches ; }
Recursive version of preg_grep.

@param  string  $pattern
@param  array  $haystack
@return array
Recursive version of preg_grep .