@@ -60,7 +60,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
60
60
$ mapping ['source ' ]['path ' ],
61
61
$ mapping ['destination ' ],
62
62
isset ($ mapping ['types ' ]) ? $ mapping ['types ' ] : array (),
63
- isset ($ mapping ['parameters ' ]) ? $ mapping ['parameters ' ] : array ()
63
+ isset ($ mapping ['parameters ' ]) ? $ mapping ['parameters ' ] : array (),
64
+ isset ($ mapping ['options ' ]) ? $ mapping ['options ' ]: array ()
64
65
);
65
66
break ;
66
67
case 'url ' :
@@ -78,7 +79,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
78
79
$ mapping ['source ' ],
79
80
$ mapping ['destination ' ],
80
81
isset ($ mapping ['types ' ]) ? $ mapping ['types ' ] : array (),
81
- isset ($ mapping ['parameters ' ]) ? $ mapping ['parameters ' ] : array ()
82
+ isset ($ mapping ['parameters ' ]) ? $ mapping ['parameters ' ] : array (),
83
+ isset ($ mapping ['options ' ]) ? $ mapping ['options ' ]: array ()
82
84
);
83
85
}
84
86
}
@@ -105,23 +107,23 @@ private function processUrlMapping($source, $destination, $types = array(), $par
105
107
106
108
$ this ->writeDoc (
107
109
$ destination ,
108
- $ this ->generateDoc ($ decoded , $ types , $ parameters )
110
+ $ this ->generateDoc ($ decoded , $ types , $ parameters, $ options )
109
111
);
110
112
}
111
113
112
- private function processFileMapping ($ source , $ destination , $ types = array (), $ parameters = array ())
114
+ private function processFileMapping ($ source , $ destination , $ types = array (), $ parameters = array (), $ options = array () )
113
115
{
114
116
$ json = file_get_contents ($ source );
115
117
116
118
$ decoded = json_decode ($ json , true );
117
119
118
120
$ this ->writeDoc (
119
121
$ destination ,
120
- $ this ->generateDoc ($ decoded , $ types , $ parameters )
122
+ $ this ->generateDoc ($ decoded , $ types , $ parameters, $ options )
121
123
);
122
124
}
123
125
124
- private function generateDoc ($ decodedJsonData , $ types , $ parameters )
126
+ private function generateDoc ($ decodedJsonData , $ types , $ parameters, $ options = array () )
125
127
{
126
128
$ docblock = "" ;
127
129
foreach ($ decodedJsonData as $ key =>$ value ) {
@@ -135,7 +137,15 @@ private function generateDoc($decodedJsonData, $types, $parameters)
135
137
}
136
138
137
139
if (!isset ($ parameters [$ key ])) {
138
- $ params = "... \$parameters " ;
140
+ //Arrays are always descendable
141
+ if ($ type == 'array ' ) {
142
+ $ params = "... \$parameters " ;
143
+ }
144
+ else if (isset ($ options ['parameter_default ' ])) {
145
+ $ params = $ options ['parameter_default ' ];
146
+ } else {
147
+ $ params = "... \$parameters " ;
148
+ }
139
149
} else {
140
150
$ params = $ parameters [$ key ];
141
151
}
0 commit comments