@@ -267,17 +267,17 @@ private function writeClass(string $namespacedClass, string $apiPath, array $pro
267
267
$ parameters = [];
268
268
$ docblock = '' ;
269
269
270
- foreach ($ specs ['parameters ' ] as $ parameter )
270
+ foreach ($ specs ['parameters ' ] ?? [] as $ parameter )
271
271
{
272
272
if (isset ($ parameter ['schema ' ]))
273
273
{
274
274
$ type = $ this ->getTypeNameFromRef ($ parameter ['schema ' ]['$ref ' ]);
275
275
}
276
276
else
277
277
{
278
- $ type = $ this ->getPHPType ($ parameter ['type ' ]);
278
+ $ type = $ this ->getPHPType ($ parameter ['type ' ] ?? '' );
279
279
}
280
- $ name = \str_replace (' ' , '_ ' , $ parameter ['name ' ]);
280
+ $ name = \str_replace (' ' , '_ ' , $ parameter ['name ' ] ?? '' );
281
281
282
282
if (isset ($ parameter ['enum ' ]))
283
283
{
@@ -289,11 +289,13 @@ private function writeClass(string $namespacedClass, string $apiPath, array $pro
289
289
$ csv [$ name ] = true ;
290
290
}
291
291
292
- $ docblock .= "\n\t * @param {$ type } {$ dollar }{$ name } {$ parameter ['description ' ]}" ;
293
- $ parameterString = $ parameter ['required ' ] ? '' : '? ' ;
292
+ $ description = $ parameter ['description ' ] ?? '' ;
293
+ $ docblock .= "\n\t * @param {$ type } {$ dollar }{$ name } {$ description }" ;
294
+ $ required = $ parameter ['required ' ] ?? false ;
295
+ $ parameterString = $ required ? '' : '? ' ;
294
296
$ parameterString .= $ type . ' $ ' . $ name ;
295
297
296
- if (! $ parameter [ ' required ' ] )
298
+ if (! $ required )
297
299
{
298
300
$ parameterString .= ' = null ' ;
299
301
}
@@ -611,6 +613,10 @@ private function deleteFileTree(string $path) : void
611
613
{
612
614
$ directory = __DIR__ . '/../src/ConstantContact ' . $ path ;
613
615
616
+ if (! is_dir ($ directory ))
617
+ {
618
+ mkdir ($ directory , 0x077 , true );
619
+ }
614
620
$ iterator = new \RecursiveIteratorIterator (
615
621
new \RecursiveDirectoryIterator ($ directory , \RecursiveDirectoryIterator::SKIP_DOTS ),
616
622
\RecursiveIteratorIterator::SELF_FIRST
0 commit comments