@@ -51,7 +51,6 @@ protected function addGenerator()
51
51
{
52
52
$ methods = array ();
53
53
$ routes = array ();
54
-
55
54
foreach ($ this ->routes ->all () as $ name => $ route ) {
56
55
$ compiledRoute = $ route ->compile ();
57
56
@@ -69,17 +68,19 @@ protected function get{$name}RouteInfo()
69
68
EOF
70
69
;
71
70
72
- $ routes [$ name] = true ;
71
+ $ routes [] = " ' $ name' => true, " ;
73
72
}
74
73
75
74
$ methods = implode ("\n" , $ methods );
76
- $ routes = $ this -> exportParameters ( $ routes );
75
+ $ routes = implode ( "\n" , $ routes );
77
76
78
77
return <<<EOF
79
78
80
79
public function generate( \$name, array \$parameters, \$absolute = false)
81
80
{
82
- static \$routes = $ routes;
81
+ static \$routes = array(
82
+ $ routes
83
+ );
83
84
84
85
if (!isset( \$routes[ \$name])) {
85
86
throw new \InvalidArgumentException(sprintf('Route "%s" does not exist.', \$name));
@@ -133,20 +134,4 @@ protected function endClass()
133
134
134
135
EOF ;
135
136
}
136
-
137
- protected function exportParameters ($ parameters , $ indent = 12 )
138
- {
139
- $ php = array ();
140
- foreach ($ parameters as $ key => $ value ) {
141
- if (is_array ($ value )) {
142
- $ value = $ this ->exportParameters ($ value , $ indent + 4 );
143
- } else {
144
- $ value = var_export ($ value , true );
145
- }
146
-
147
- $ php [] = sprintf ('%s%s => %s, ' , str_repeat (' ' , $ indent ), var_export ($ key , true ), $ value );
148
- }
149
-
150
- return sprintf ("array( \n%s \n%s) " , implode ("\n" , $ php ), str_repeat (' ' , $ indent - 4 ));
151
- }
152
137
}
0 commit comments