| @@ 66-78 (lines=13) @@ | ||
| 63 | * |
|
| 64 | * @return string[] |
|
| 65 | */ |
|
| 66 | public function listTypes($match = null) |
|
| 67 | { |
|
| 68 | $list = array_keys(static::$map['types']); |
|
| 69 | ||
| 70 | if (is_null($match)) { |
|
| 71 | return $list; |
|
| 72 | } else { |
|
| 73 | $re = strtr($match, ['/' => '\\/', '*' => '.*']); |
|
| 74 | return array_filter($list, function ($v) use ($re) { |
|
| 75 | return preg_match("/$re/", $v) === 1; |
|
| 76 | }); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Lists all the extensions defined in the map. |
|
| @@ 87-99 (lines=13) @@ | ||
| 84 | * |
|
| 85 | * @return string[] |
|
| 86 | */ |
|
| 87 | public function listExtensions($match = null) |
|
| 88 | { |
|
| 89 | $list = array_keys(static::$map['extensions']); |
|
| 90 | ||
| 91 | if (is_null($match)) { |
|
| 92 | return $list; |
|
| 93 | } else { |
|
| 94 | $re = strtr($match, ['*' => '.*']); |
|
| 95 | return array_filter($list, function ($v) use ($re) { |
|
| 96 | return preg_match("/$re/", $v) === 1; |
|
| 97 | }); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Determines if an entry exists form the 'types' array. |
|