/** * @inheritdoc */ public function parse(TokenStream $tokenStream) { if ($tokenStream->test(Token::T_GLOB)) { return new Glob($tokenStream->next()->getValue()); } if ($tokenStream->nextIf(Token::T_TYPE, 'glob')) { $tokenStream->expect(Token::T_COLON); } return new Glob(Glob::encode($tokenStream->expect(static::$allowedTypes)->getValue())); }
private function decodeGlob($glob) { return preg_replace_callback('/[^\\*\\?]+/i', function ($encoded) { return Glob::encode(rawurldecode($encoded[0])); }, $glob); }