@@ -116,9 +116,12 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
116
116
throw new \InvalidArgumentException (sprintf ('The <route> element in file "%s" must have an "id" and a "pattern" attribute. ' , $ path ));
117
117
}
118
118
119
+ $ schemes = array_filter (explode (' ' , $ node ->getAttribute ('schemes ' )));
120
+ $ methods = array_filter (explode (' ' , $ node ->getAttribute ('methods ' )));
121
+
119
122
list ($ defaults , $ requirements , $ options ) = $ this ->parseConfigs ($ node , $ path );
120
123
121
- $ route = new Route ($ node ->getAttribute ('pattern ' ), $ defaults , $ requirements , $ options , $ node ->getAttribute ('hostname-pattern ' ));
124
+ $ route = new Route ($ node ->getAttribute ('pattern ' ), $ defaults , $ requirements , $ options , $ node ->getAttribute ('hostname-pattern ' ), $ schemes , $ methods );
122
125
$ collection ->add ($ id , $ route );
123
126
}
124
127
@@ -141,6 +144,8 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
141
144
$ type = $ node ->getAttribute ('type ' );
142
145
$ prefix = $ node ->getAttribute ('prefix ' );
143
146
$ hostnamePattern = $ node ->hasAttribute ('hostname-pattern ' ) ? $ node ->getAttribute ('hostname-pattern ' ) : null ;
147
+ $ schemes = $ node ->hasAttribute ('schemes ' ) ? array_filter (explode (' ' , $ node ->getAttribute ('schemes ' ))) : null ;
148
+ $ methods = $ node ->hasAttribute ('methods ' ) ? array_filter (explode (' ' , $ node ->getAttribute ('methods ' ))) : null ;
144
149
145
150
list ($ defaults , $ requirements , $ options ) = $ this ->parseConfigs ($ node , $ path );
146
151
@@ -152,6 +157,12 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $
152
157
if (null !== $ hostnamePattern ) {
153
158
$ subCollection ->setHostnamePattern ($ hostnamePattern );
154
159
}
160
+ if (null !== $ schemes ) {
161
+ $ subCollection ->setSchemes ($ schemes );
162
+ }
163
+ if (null !== $ methods ) {
164
+ $ subCollection ->setMethods ($ methods );
165
+ }
155
166
$ subCollection ->addDefaults ($ defaults );
156
167
$ subCollection ->addRequirements ($ requirements );
157
168
$ subCollection ->addOptions ($ options );
0 commit comments