28
28
class YamlFileLoader extends FileLoader
29
29
{
30
30
private static $ availableKeys = array (
31
- 'resource ' , 'type ' , 'prefix ' , 'pattern ' , 'hostname_pattern ' , 'defaults ' , 'requirements ' , 'options ' ,
31
+ 'resource ' , 'type ' , 'prefix ' , 'pattern ' , 'hostname_pattern ' , 'schemes ' , ' methods ' , ' defaults ' , 'requirements ' , 'options ' ,
32
32
);
33
33
34
34
/**
@@ -98,9 +98,11 @@ protected function parseRoute(RouteCollection $collection, $name, array $config,
98
98
$ defaults = isset ($ config ['defaults ' ]) ? $ config ['defaults ' ] : array ();
99
99
$ requirements = isset ($ config ['requirements ' ]) ? $ config ['requirements ' ] : array ();
100
100
$ options = isset ($ config ['options ' ]) ? $ config ['options ' ] : array ();
101
- $ hostnamePattern = isset ($ config ['hostname_pattern ' ]) ? $ config ['hostname_pattern ' ] : null ;
101
+ $ hostnamePattern = isset ($ config ['hostname_pattern ' ]) ? $ config ['hostname_pattern ' ] : '' ;
102
+ $ schemes = isset ($ config ['schemes ' ]) ? $ config ['schemes ' ] : array ();
103
+ $ methods = isset ($ config ['methods ' ]) ? $ config ['methods ' ] : array ();
102
104
103
- $ route = new Route ($ config ['pattern ' ], $ defaults , $ requirements , $ options , $ hostnamePattern );
105
+ $ route = new Route ($ config ['pattern ' ], $ defaults , $ requirements , $ options , $ hostnamePattern, $ schemes , $ methods );
104
106
105
107
$ collection ->add ($ name , $ route );
106
108
}
@@ -121,6 +123,8 @@ protected function parseImport(RouteCollection $collection, array $config, $path
121
123
$ requirements = isset ($ config ['requirements ' ]) ? $ config ['requirements ' ] : array ();
122
124
$ options = isset ($ config ['options ' ]) ? $ config ['options ' ] : array ();
123
125
$ hostnamePattern = isset ($ config ['hostname_pattern ' ]) ? $ config ['hostname_pattern ' ] : null ;
126
+ $ schemes = isset ($ config ['schemes ' ]) ? $ config ['schemes ' ] : null ;
127
+ $ methods = isset ($ config ['methods ' ]) ? $ config ['methods ' ] : null ;
124
128
125
129
$ this ->setCurrentDir (dirname ($ path ));
126
130
@@ -130,6 +134,12 @@ protected function parseImport(RouteCollection $collection, array $config, $path
130
134
if (null !== $ hostnamePattern ) {
131
135
$ subCollection ->setHostnamePattern ($ hostnamePattern );
132
136
}
137
+ if (null !== $ schemes ) {
138
+ $ subCollection ->setSchemes ($ schemes );
139
+ }
140
+ if (null !== $ methods ) {
141
+ $ subCollection ->setMethods ($ methods );
142
+ }
133
143
$ subCollection ->addDefaults ($ defaults );
134
144
$ subCollection ->addRequirements ($ requirements );
135
145
$ subCollection ->addOptions ($ options );
0 commit comments