@@ -80,9 +80,9 @@ public function makeDefinitions(array $definitions) : void
80
80
81
81
public function generateDefinition (string $ namespacedClass , array $ properties ) : void
82
82
{
83
- $ parts = explode ('\\' , $ namespacedClass );
84
- $ class = array_pop ($ parts );
85
- $ namespace = implode ('\\' , $ parts );
83
+ $ parts = \ explode ('\\' , $ namespacedClass );
84
+ $ class = \ array_pop ($ parts );
85
+ $ namespace = \ implode ('\\' , $ parts );
86
86
$ originalType = '' ;
87
87
88
88
if (! isset ($ properties ['type ' ]))
@@ -180,6 +180,7 @@ public function generateDefinition(string $namespacedClass, array $properties) :
180
180
}
181
181
182
182
$ description = '' ;
183
+
183
184
if (isset ($ details ['description ' ]))
184
185
{
185
186
$ description = $ this ->cleanDescription (\trim ($ details ['description ' ]));
@@ -190,7 +191,7 @@ public function generateDefinition(string $namespacedClass, array $properties) :
190
191
$ type = $ originalType ;
191
192
}
192
193
$ type = \str_replace ('\\\\' , '\\' , $ type );
193
- $ docBlock [] = trim ("{$ type } {$ dollar }{$ name } {$ description }" );
194
+ $ docBlock [] = \ trim ("{$ type } {$ dollar }{$ name } {$ description }" );
194
195
}
195
196
$ this ->generateFromTemplate ($ class , ['fields ' => $ fields , 'minLength ' => $ minLength , 'maxLength ' => $ maxLength , ], $ docBlock );
196
197
}
@@ -203,8 +204,9 @@ public function generateDefinition(string $namespacedClass, array $properties) :
203
204
*/
204
205
private function getUniqueClassName (string $ namespace , string $ class ) : string
205
206
{
206
- $ namespace = trim ($ namespace , '\\' );
207
+ $ namespace = \ trim ($ namespace , '\\' );
207
208
$ class = $ this ->getClassName ($ class );
209
+
208
210
if (isset ($ this ->duplicateClasses [$ class ]))
209
211
{
210
212
$ class = $ this ->duplicateClasses [$ class ];
@@ -217,7 +219,7 @@ private function getUniqueClassName(string $namespace, string $class) : string
217
219
$ fullName = '\\' . $ namespace . '\\' . $ class ;
218
220
219
221
// if we have seen this class before, then it is the plural version and it should be singular because CC does not know how to design an API (among other things).
220
- if (! str_contains ($ fullName , 'Definition ' ) && isset ($ this ->generatedClasses [$ fullName ]))
222
+ if (! \ str_contains ($ fullName , 'Definition ' ) && isset ($ this ->generatedClasses [$ fullName ]))
221
223
{
222
224
if (\str_ends_with ($ class , 'ies ' ))
223
225
{
@@ -238,9 +240,9 @@ private function getUniqueClassName(string $namespace, string $class) : string
238
240
239
241
private function writeClass (string $ namespacedClass , string $ apiPath , array $ properties ) : void
240
242
{
241
- $ parts = explode ('\\' , $ namespacedClass );
242
- $ class = array_pop ($ parts );
243
- $ namespace = trim (implode ('\\' , $ parts ), '\\' );
243
+ $ parts = \ explode ('\\' , $ namespacedClass );
244
+ $ class = \ array_pop ($ parts );
245
+ $ namespace = \ trim (\ implode ('\\' , $ parts ), '\\' );
244
246
245
247
$ methods = '' ;
246
248
$ dollar = '$ ' ;
@@ -499,7 +501,7 @@ private function formatDescription(string $description) : string
499
501
*/
500
502
private function generateFromTemplate (string $ name , array $ properties , array $ docBlocks ) : void
501
503
{
502
- $ namespace = trim ($ this ->definitionNamespace , '\\' );
504
+ $ namespace = \ trim ($ this ->definitionNamespace , '\\' );
503
505
504
506
$ template = <<<PHP
505
507
<?php
@@ -588,21 +590,21 @@ private function deleteFileTree(string $path) : void
588
590
$ directory = __DIR__ . '/../src/ConstantContact ' . $ path ;
589
591
590
592
$ iterator = new \RecursiveIteratorIterator (
591
- new \RecursiveDirectoryIterator ($ directory , \RecursiveDirectoryIterator::SKIP_DOTS ),
592
- \RecursiveIteratorIterator::SELF_FIRST );
593
+ new \RecursiveDirectoryIterator ($ directory , \RecursiveDirectoryIterator::SKIP_DOTS ),
594
+ \RecursiveIteratorIterator::SELF_FIRST
595
+ );
593
596
594
597
foreach ($ iterator as $ item )
595
598
{
596
599
if (! $ item ->isDir ())
597
600
{
598
601
$ fileName = "{$ item }" ;
599
602
// don't delete base classes
600
- if (! str_ends_with ($ fileName , 'Base.php ' ))
603
+ if (! \ str_ends_with ($ fileName , 'Base.php ' ))
601
604
{
602
- unlink ($ fileName );
605
+ \ unlink ($ fileName );
603
606
}
604
607
}
605
608
}
606
609
}
607
-
608
610
}
0 commit comments