@@ -26,9 +26,9 @@ public static function validFilePath(string $path): bool
26
26
27
27
public static function specTestDirectory ($ project_dir )
28
28
{
29
- $ normalized_project_dir = '/ ' . ltrim ($ project_dir , '/ ' );
29
+ $ normalized_project_dir = '/ ' . ltrim ($ project_dir , '/ ' );
30
30
31
- return $ normalized_project_dir. '/tests/Spec ' ;
31
+ return $ normalized_project_dir . '/tests/Spec ' ;
32
32
}
33
33
34
34
public static function scandirRecursively ($ dir )
@@ -77,7 +77,7 @@ public static function specFilesInDir(string $dir, string $format)
77
77
if (is_dir ($ item ) || !PapiMethods::validExtension ($ format , $ extension )) {
78
78
return false ;
79
79
} else {
80
- return strlen ('' . basename ($ item , '. ' . $ extension )) > 0 ;
80
+ return strlen ('' . basename ($ item , '. ' . $ extension )) > 0 ;
81
81
}
82
82
});
83
83
}
@@ -89,7 +89,7 @@ public static function specFilesInDir(string $dir, string $format)
89
89
public static function specNameAndVersion ($ spec_file )
90
90
{
91
91
$ extension = pathinfo ($ spec_file , PATHINFO_EXTENSION );
92
- $ file_name = '' . basename ($ spec_file , '. ' . $ extension );
92
+ $ file_name = '' . basename ($ spec_file , '. ' . $ extension );
93
93
$ split_index = strpos ($ file_name , '. ' );
94
94
$ spec_name = substr ($ file_name , 0 , $ split_index );
95
95
$ spec_version = substr ($ file_name , $ split_index + 1 );
@@ -215,7 +215,7 @@ public static function arrayFindRecursive(array $haystack, $needle, $glue = '.')
215
215
}
216
216
217
217
yield [
218
- 'path ' => '[ ' . str_replace ('. ' , '][ ' , implode ($ glue , $ keys )). '] ' ,
218
+ 'path ' => '[ ' . str_replace ('. ' , '][ ' , implode ($ glue , $ keys )) . '] ' ,
219
219
'value ' => $ value ,
220
220
];
221
221
}
@@ -286,7 +286,7 @@ public static function formatOperationKey($operation_key)
286
286
$ trimmed_key = substr ($ operation_key , 1 , -1 );
287
287
$ parts = explode ('][ ' , $ trimmed_key );
288
288
289
- return strtoupper ($ parts [2 ]). ' ' . $ parts [1 ];
289
+ return strtoupper ($ parts [2 ]) . ' ' . $ parts [1 ];
290
290
}
291
291
292
292
public static function formatEnumKey ($ property_key )
@@ -306,7 +306,7 @@ public static function matchingOperationKeys($a_open_api, $b_open_api)
306
306
$ path = $ key_path [1 ];
307
307
$ operation = $ key_path [2 ];
308
308
309
- if (isset ($ b_open_api ->paths [$ path ]-> getOperations ()[$ operation ]) ) {
309
+ if (isset ($ b_open_api ->paths [$ path ]) && $ b_open_api -> paths [ $ path ]-> getOperations ()[$ operation ]) {
310
310
yield $ operation_key ;
311
311
}
312
312
}
@@ -352,10 +352,10 @@ public static function getSchemaArrayFromSpecObject(?SpecBaseObject $object)
352
352
public static function fullyQualifiedClassName ($ path , $ spec_name , $ spec_version )
353
353
{
354
354
$ path_segments = PapiMethods::specPathToSegments ($ path );
355
- $ class_name = join ('' , $ path_segments ). 'Test ' ;
356
- $ class_namespace = 'Tests\Spec \\' . ucfirst ($ spec_name ). '\\' . str_replace ('- ' , '_ ' , $ spec_version );
355
+ $ class_name = join ('' , $ path_segments ) . 'Test ' ;
356
+ $ class_namespace = 'Tests\Spec \\' . ucfirst ($ spec_name ) . '\\' . str_replace ('- ' , '_ ' , $ spec_version );
357
357
358
- return $ class_namespace. '\\' . $ class_name ;
358
+ return $ class_namespace . '\\' . $ class_name ;
359
359
}
360
360
361
361
public static function models ($ models_dir , $ format )
@@ -367,9 +367,9 @@ public static function models($models_dir, $format)
367
367
$ models_dir = basename (dirname ($ model_path ));
368
368
369
369
$ extension = pathinfo ($ model_path , PATHINFO_EXTENSION );
370
- $ model_name = basename ($ model_path , '. ' . $ extension );
370
+ $ model_name = basename ($ model_path , '. ' . $ extension );
371
371
372
- $ model_key = $ models_dir. DIRECTORY_SEPARATOR . $ model_name ;
372
+ $ model_key = $ models_dir . DIRECTORY_SEPARATOR . $ model_name ;
373
373
374
374
if (!isset ($ models [$ model_key ])) {
375
375
$ models [$ model_key ] = $ model_key ;
@@ -397,12 +397,12 @@ public static function operationKeysFromOpenApi($open_api, $path_format = false)
397
397
foreach ($ pathItem ->getOperations () as $ method_key => $ operationItem ) {
398
398
if (in_array ($ method_key , $ valid_methods , true )) {
399
399
if ($ path_format ) {
400
- $ key_and_value = '[paths][ ' . $ path_key. '][ ' . $ method_key. '] ' ;
400
+ $ key_and_value = '[paths][ ' . $ path_key . '][ ' . $ method_key . '] ' ;
401
401
if (!isset ($ operations [$ key_and_value ])) {
402
402
$ operations [$ key_and_value ] = $ key_and_value ;
403
403
}
404
404
} else {
405
- $ key_and_value = strtoupper ($ method_key ). ' ' . $ path_key ;
405
+ $ key_and_value = strtoupper ($ method_key ) . ' ' . $ path_key ;
406
406
if (!isset ($ operations [$ key_and_value ])) {
407
407
$ operations [$ key_and_value ] = $ key_and_value ;
408
408
}
@@ -481,7 +481,7 @@ public static function versionsEqualToOrBelow($spec_dir, $version, $format)
481
481
482
482
$ spec_versions = array_map (function ($ a ) {
483
483
$ extension = pathinfo ($ a , PATHINFO_EXTENSION );
484
- $ base_name = basename ($ a , '. ' . $ extension );
484
+ $ base_name = basename ($ a , '. ' . $ extension );
485
485
486
486
return substr ($ base_name , strpos ($ base_name , '. ' ) + 1 );
487
487
}, $ spec_files );
@@ -499,7 +499,7 @@ public static function versionsBetween($spec_dir, $version_floor, $include_floor
499
499
500
500
$ spec_versions = array_map (function ($ a ) {
501
501
$ extension = pathinfo ($ a , PATHINFO_EXTENSION );
502
- $ base_name = basename ($ a , '. ' . $ extension );
502
+ $ base_name = basename ($ a , '. ' . $ extension );
503
503
504
504
return substr ($ base_name , strpos ($ base_name , '. ' ) + 1 );
505
505
}, $ spec_files );
0 commit comments