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;
  }