@@ -230,36 +230,38 @@ public static function parse(Parser $parser, TokensList $list, array $options =
230230 */
231231 public static function build ($ component )
232232 {
233- $ ret = array ();
234-
235- foreach ($ component as $ c ) {
233+ if (is_array ($ component )) {
234+ $ ret = array ();
235+ foreach ($ component as $ c ) {
236+ $ ret [] = static ::build ($ c );
237+ }
238+ return "( \n" . implode (", \n" , $ ret ) . "\n) " ;
239+ } else {
236240 $ tmp = '' ;
237241
238- if ($ f ->isConstraint ) {
242+ if ($ component ->isConstraint ) {
239243 $ tmp .= 'CONSTRAINT ' ;
240244 }
241245
242- if (!empty ($ f ->name )) {
243- $ tmp .= Context::escape ($ f ->name ) . ' ' ;
246+ if (!empty ($ component ->name )) {
247+ $ tmp .= Context::escape ($ component ->name ) . ' ' ;
244248 }
245249
246- if (!empty ($ f ->type )) {
247- $ tmp .= DataType::build ($ f ->type ) . ' ' ;
250+ if (!empty ($ component ->type )) {
251+ $ tmp .= DataType::build ($ component ->type ) . ' ' ;
248252 }
249253
250- if (!empty ($ f ->key )) {
251- $ tmp .= Key::build ($ f ->key ) . ' ' ;
254+ if (!empty ($ component ->key )) {
255+ $ tmp .= Key::build ($ component ->key ) . ' ' ;
252256 }
253257
254- if (!empty ($ f ->references )) {
255- $ tmp .= 'REFERENCES ' . Reference::build ($ f ->references ) . ' ' ;
258+ if (!empty ($ component ->references )) {
259+ $ tmp .= 'REFERENCES ' . Reference::build ($ component ->references ) . ' ' ;
256260 }
257261
258- $ tmp .= OptionsArray::build ($ f ->options );
262+ $ tmp .= OptionsArray::build ($ component ->options );
259263
260- $ ret [] = trim ($ tmp );
264+ return trim ($ tmp );
261265 }
262-
263- return "( \n" . implode (", \n" , $ ret ) . "\n) " ;
264266 }
265267}
0 commit comments