private static function expandFilenameBraces($pattern) {
    $result = [];
    if (preg_match(self::BRACE_PATTERN, $pattern, $matches) === 1) {
      $items = explode(",", $matches[2]);
      foreach($items as $match) {
        $str = $matches[1] . $match . $matches[3];
        $exp = static::expandFilenameBraces($str);
        $result = array_merge($result, $exp);
      }
    } else {
      $result[] = $pattern;
    }
    return $result;
  }
private static function expandFilenameBraces($pattern) {
    $result = [];
    if (preg_match(self::BRACE_PATTERN, $pattern, $matches) === 1) {
      $items = explode(",", $matches[2]);
      foreach($items as $match) {
        $str = $matches[1] . $match . $matches[3];
        $exp = static::expandFilenameBraces($str);
        $result = array_merge($result, $exp);
      }
    } else {
      $result[] = $pattern;
    }
    return $result;
  }
private static function expandFilenameBraces ( $ pattern ) { $ result = [ ] ; if ( preg_match ( self :: BRACE_PATTERN , $ pattern , $ matches ) === 1 ) { $ items = explode ( "," , $ matches [ 2 ] ) ; foreach ( $ items as $ match ) { $ str = $ matches [ 1 ] . $ match . $ matches [ 3 ] ; $ exp = static :: expandFilenameBraces ( $ str ) ; $ result = array_merge ( $ result , $ exp ) ; } } else { $ result [ ] = $ pattern ; } return $ result ; }
Expand out any braces in the incomming pattern, acording to shell brace
rules.

@param $pattern The pattern to expand.
@return An array where any braces have been expanded.
Expand out any braces in the incomming pattern acording to shell brace rules .