@@ -84,7 +84,7 @@ public static function getWrappedType($name)
84
84
{
85
85
return isset (self ::$ wrappedTypes [$ name ]) ? self ::$ wrappedTypes [$ name ] : null ;
86
86
}
87
-
87
+
88
88
protected function generateParentClassName (array $ config )
89
89
{
90
90
return $ this ->shortenClassName (self ::$ typeSystems [$ config ['type ' ]]);
@@ -109,18 +109,18 @@ protected function generateClassDocBlock(array $config)
109
109
EOF ;
110
110
}
111
111
112
- protected function varExportFromArrayValue (array $ values , $ key , $ default = 'null ' )
112
+ protected function varExportFromArrayValue (array $ values , $ key , $ default = 'null ' , array $ compilerNames = [] )
113
113
{
114
114
if (!isset ($ values [$ key ])) {
115
115
return $ default ;
116
116
}
117
117
118
- $ code = $ this ->varExport ($ values [$ key ], $ default );
118
+ $ code = $ this ->varExport ($ values [$ key ], $ default, $ compilerNames );
119
119
120
120
return $ code ;
121
121
}
122
122
123
- protected function varExport ($ var , $ default = null )
123
+ protected function varExport ($ var , $ default = null , array $ compilerNames = [] )
124
124
{
125
125
switch (true ) {
126
126
case is_array ($ var ):
@@ -133,7 +133,7 @@ protected function varExport($var, $default = null)
133
133
return "[ " . implode (", " , $ r ) . "] " ;
134
134
135
135
case $ this ->isExpression ($ var ):
136
- return $ code = $ this ->getExpressionLanguage ()->compile ($ var );
136
+ return $ code = $ this ->getExpressionLanguage ()->compile ($ var, $ compilerNames );
137
137
138
138
case is_object ($ var ):
139
139
return $ default ;
@@ -155,7 +155,7 @@ protected function processFromArray(array $values, $templatePrefix)
155
155
return '[ ' . $ this ->prefixCodeWithSpaces ($ code , 2 ) . "\n<spaces>] " ;
156
156
}
157
157
158
- protected function callableCallbackFromArrayValue (array $ value , $ key , $ argDefinitions = null , $ default = 'null ' )
158
+ protected function callableCallbackFromArrayValue (array $ value , $ key , $ argDefinitions = null , $ default = 'null ' , array $ compilerNames = null )
159
159
{
160
160
if (!isset ($ value [$ key ])) {
161
161
return $ default ;
@@ -177,13 +177,14 @@ protected function callableCallbackFromArrayValue(array $value, $key, $argDefini
177
177
return $ code ;
178
178
}
179
179
} elseif ($ this ->isExpression ($ value [$ key ])) {
180
- preg_match_all ('@\$([a-z_][a-z0-9_]+)@i ' , $ argDefinitions , $ matches );
181
-
182
- $ argNames = isset ($ matches [1 ]) ? $ matches [1 ] : [];
180
+ if (null === $ compilerNames ) {
181
+ preg_match_all ('@\$([a-z_][a-z0-9_]+)@i ' , $ argDefinitions , $ matches );
182
+ $ compilerNames = isset ($ matches [1 ]) ? $ matches [1 ] : [];
183
+ }
183
184
$ code = sprintf (
184
185
$ code ,
185
186
$ this ->shortenClassFromCode ($ argDefinitions ),
186
- $ this ->getExpressionLanguage ()->compile ($ value [$ key ], $ argNames )
187
+ $ this ->getExpressionLanguage ()->compile ($ value [$ key ], $ compilerNames )
187
188
);
188
189
189
190
return $ code ;
0 commit comments