@@ -38,9 +38,7 @@ public function match($pathinfo)
3838 goto not_bar;
3939 }
4040
41- $ matches ['_route ' ] = 'bar ' ;
42-
43- return $ matches ;
41+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'bar ' )), array ());
4442 }
4543 not_bar:
4644
@@ -51,9 +49,7 @@ public function match($pathinfo)
5149 goto not_barhead;
5250 }
5351
54- $ matches ['_route ' ] = 'barhead ' ;
55-
56- return $ matches ;
52+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'barhead ' )), array ());
5753 }
5854 not_barhead:
5955
@@ -80,9 +76,7 @@ public function match($pathinfo)
8076
8177 // baz4
8278 if (preg_match ('#^/test/(?<foo>[^/]++)/$#s ' , $ pathinfo , $ matches )) {
83- $ matches ['_route ' ] = 'baz4 ' ;
84-
85- return $ matches ;
79+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'baz4 ' )), array ());
8680 }
8781
8882 // baz5
@@ -92,9 +86,7 @@ public function match($pathinfo)
9286 goto not_baz5;
9387 }
9488
95- $ matches ['_route ' ] = 'baz5 ' ;
96-
97- return $ matches ;
89+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'baz5 ' )), array ());
9890 }
9991 not_baz5:
10092
@@ -105,9 +97,7 @@ public function match($pathinfo)
10597 goto not_bazbaz6;
10698 }
10799
108- $ matches ['_route ' ] = 'baz.baz6 ' ;
109-
110- return $ matches ;
100+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'baz.baz6 ' )), array ());
111101 }
112102 not_bazbaz6:
113103
@@ -120,9 +110,7 @@ public function match($pathinfo)
120110
121111 // quoter
122112 if (preg_match ('#^/(?<quoter>[ \']+)$#s ' , $ pathinfo , $ matches )) {
123- $ matches ['_route ' ] = 'quoter ' ;
124-
125- return $ matches ;
113+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'quoter ' )), array ());
126114 }
127115
128116 // space
@@ -134,40 +122,30 @@ public function match($pathinfo)
134122 if (0 === strpos ($ pathinfo , '/a/b \'b ' )) {
135123 // foo1
136124 if (preg_match ('#^/a/b \'b/(?<foo>[^/]++)$#s ' , $ pathinfo , $ matches )) {
137- $ matches ['_route ' ] = 'foo1 ' ;
138-
139- return $ matches ;
125+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'foo1 ' )), array ());
140126 }
141127
142128 // bar1
143129 if (preg_match ('#^/a/b \'b/(?<bar>[^/]++)$#s ' , $ pathinfo , $ matches )) {
144- $ matches ['_route ' ] = 'bar1 ' ;
145-
146- return $ matches ;
130+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'bar1 ' )), array ());
147131 }
148132
149133 }
150134
151135 // overridden
152136 if (preg_match ('#^/a/(?<var>.*)$#s ' , $ pathinfo , $ matches )) {
153- $ matches ['_route ' ] = 'overridden ' ;
154-
155- return $ matches ;
137+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'overridden ' )), array ());
156138 }
157139
158140 if (0 === strpos ($ pathinfo , '/a/b \'b ' )) {
159141 // foo2
160142 if (preg_match ('#^/a/b \'b/(?<foo1>[^/]++)$#s ' , $ pathinfo , $ matches )) {
161- $ matches ['_route ' ] = 'foo2 ' ;
162-
163- return $ matches ;
143+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'foo2 ' )), array ());
164144 }
165145
166146 // bar2
167147 if (preg_match ('#^/a/b \'b/(?<bar1>[^/]++)$#s ' , $ pathinfo , $ matches )) {
168- $ matches ['_route ' ] = 'bar2 ' ;
169-
170- return $ matches ;
148+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'bar2 ' )), array ());
171149 }
172150
173151 }
@@ -194,16 +172,12 @@ public function match($pathinfo)
194172
195173 // foo3
196174 if (preg_match ('#^/(?<_locale>[^/]++)/b/(?<foo>[^/]++)$#s ' , $ pathinfo , $ matches )) {
197- $ matches ['_route ' ] = 'foo3 ' ;
198-
199- return $ matches ;
175+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'foo3 ' )), array ());
200176 }
201177
202178 // bar3
203179 if (preg_match ('#^/(?<_locale>[^/]++)/b/(?<bar>[^/]++)$#s ' , $ pathinfo , $ matches )) {
204- $ matches ['_route ' ] = 'bar3 ' ;
205-
206- return $ matches ;
180+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'bar3 ' )), array ());
207181 }
208182
209183 if (0 === strpos ($ pathinfo , '/aba ' )) {
@@ -214,9 +188,7 @@ public function match($pathinfo)
214188
215189 // foo4
216190 if (preg_match ('#^/aba/(?<foo>[^/]++)$#s ' , $ pathinfo , $ matches )) {
217- $ matches ['_route ' ] = 'foo4 ' ;
218-
219- return $ matches ;
191+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'foo4 ' )), array ());
220192 }
221193
222194 }
@@ -269,10 +241,7 @@ public function match($pathinfo)
269241 if (0 === strpos ($ pathinfo , '/route1 ' )) {
270242 // route11
271243 if ($ pathinfo === '/route11 ' ) {
272- $ matches = $ hostnameMatches ;
273- $ matches ['_route ' ] = 'route11 ' ;
274-
275- return $ matches ;
244+ return $ this ->mergeDefaults (array_replace ($ hostnameMatches , array ('_route ' => 'route11 ' )), array ());
276245 }
277246
278247 // route12
@@ -282,10 +251,7 @@ public function match($pathinfo)
282251
283252 // route13
284253 if (0 === strpos ($ pathinfo , '/route13 ' ) && preg_match ('#^/route13/(?<name>[^/]++)$#s ' , $ pathinfo , $ matches )) {
285- $ matches = array_replace ($ hostnameMatches , $ matches );
286- $ matches ['_route ' ] = 'route13 ' ;
287-
288- return $ matches ;
254+ return $ this ->mergeDefaults (array_replace ($ hostnameMatches , $ matches , array ('_route ' => 'route13 ' )), array ());
289255 }
290256
291257 // route14
@@ -300,9 +266,7 @@ public function match($pathinfo)
300266 if (preg_match ('#^c \\.example \\.com$#s ' , $ hostname , $ hostnameMatches )) {
301267 // route15
302268 if (0 === strpos ($ pathinfo , '/route15 ' ) && preg_match ('#^/route15/(?<name>[^/]++)$#s ' , $ pathinfo , $ matches )) {
303- $ matches ['_route ' ] = 'route15 ' ;
304-
305- return $ matches ;
269+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'route15 ' )), array ());
306270 }
307271
308272 }
@@ -329,16 +293,12 @@ public function match($pathinfo)
329293 if (0 === strpos ($ pathinfo , '/a/b ' )) {
330294 // b
331295 if (preg_match ('#^/a/b/(?<var>[^/]++)$#s ' , $ pathinfo , $ matches )) {
332- $ matches ['_route ' ] = 'b ' ;
333-
334- return $ matches ;
296+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'b ' )), array ());
335297 }
336298
337299 // c
338300 if (0 === strpos ($ pathinfo , '/a/b/c ' ) && preg_match ('#^/a/b/c/(?<var>[^/]++)$#s ' , $ pathinfo , $ matches )) {
339- $ matches ['_route ' ] = 'c ' ;
340-
341- return $ matches ;
301+ return $ this ->mergeDefaults (array_replace ($ matches , array ('_route ' => 'c ' )), array ());
342302 }
343303
344304 }
0 commit comments