1212
1313class OpenApiRenderer extends BaseTemplateRenderer
1414{
15- const NO_DESCRIPTION_PROVIDED = 'No description provided ' ;
15+ private const NO_DESCRIPTION_PROVIDED = 'No description provided ' ;
1616
1717 public function init (object $ json ): self
1818 {
@@ -131,24 +131,26 @@ private function getPaths(): object
131131 }
132132 $ cleaned_href = preg_replace ('/{\?.*}/ ' , '' , $ transition ->href );
133133 $ cleaned_href = rtrim ($ cleaned_href , "/ " );
134- $ optional_paths = array_filter ($ parameters , fn ($ parameter ) => $ parameter ['in ' ] === 'path ' && $ parameter ['required ' ] === FALSE );
134+ $ optional_paths = array_filter ($ parameters , fn ($ parameter ) => $ parameter ['in ' ] === 'path ' && $ parameter ['required ' ] === false );
135135 if ($ optional_paths === []) {
136136 $ return [$ cleaned_href ] = (object ) $ transition_return ;
137137 continue ;
138138 }
139139
140140 $ cleaned_parameters = [];
141- $ optional_href = NULL ;
141+ $ optional_href = null ;
142142 foreach ($ parameters as $ key => $ parameter ) {
143- if ($ parameter ['in ' ] === 'path ' && $ parameter ['required ' ] === TRUE ) {
143+ if ($ parameter ['in ' ] === 'path ' && $ parameter ['required ' ] === true ) {
144144 $ cleaned_parameters [] = $ parameter ;
145145 continue ;
146146 }
147147
148- if ($ parameter ['in ' ] !== 'path ' ) { continue ; }
148+ if ($ parameter ['in ' ] !== 'path ' ) {
149+ continue ;
150+ }
149151
150152 $ optional_href = str_replace ("/{ {$ parameter ["name " ]}} " , '' , $ cleaned_href );
151- $ parameters [$ key ]['required ' ] = TRUE ;
153+ $ parameters [$ key ]['required ' ] = true ;
152154 }
153155
154156 //Full path
@@ -230,7 +232,7 @@ private function toOperation(HTTPRequest $request, Transition $transition, array
230232 }
231233
232234 $ body = $ this ->toBody ($ request );
233- if ($ body === NULL ) {
235+ if ($ body === null ) {
234236 return $ operation ;
235237 }
236238
@@ -363,7 +365,7 @@ private function toResponses(array $responses): array
363365 private function toBody (HTTPRequest $ request ): ?array
364366 {
365367 if (in_array ($ request ->method , ['GET ' , 'DELETE ' ], true )) {
366- return NULL ;
368+ return null ;
367369 }
368370
369371 $ return = ['content ' => []];
@@ -446,7 +448,8 @@ private function getComponent(BasicStructureElement $structure): array
446448 {
447449 $ object = [];
448450 if ($ this ->isRef ($ structure ->element ) && $ structure ->element !== 'enum ' ) {
449- $ object ['$ref ' ] = '#/components/schemas/ ' . $ this ->refIdFromType ($ structure ->element === 'member ' ? $ structure ->type : $ structure ->element );;
451+ $ object ['$ref ' ] = '#/components/schemas/ ' . $ this ->refIdFromType ($ structure ->element === 'member ' ? $ structure ->type : $ structure ->element );
452+ ;
450453 return $ object ;
451454 }
452455
@@ -471,7 +474,8 @@ private function getComponent(BasicStructureElement $structure): array
471474 case 'enum ' :
472475// $object['type'] = $structure->type;;
473476 case 'array ' :
474- $ object ['items ' ] = (object ) $ properties ;;
477+ $ object ['items ' ] = (object ) $ properties ;
478+ ;
475479 break ;
476480 case 'object ' :
477481 $ object ['properties ' ] = $ properties ;
@@ -544,7 +548,8 @@ private function getSchemaProperty(BasicStructureElement|ElementStructureElement
544548 return $ propery_data ;
545549 } elseif ($ value ->type === 'object ' ) {
546550 $ propery_data ['type ' ] = $ value ->type ;
547- $ propery_data ['properties ' ] = $ this ->getComponent ($ value ->value )['properties ' ] ?? new class {};
551+ $ propery_data ['properties ' ] = $ this ->getComponent ($ value ->value )['properties ' ] ?? new class {
552+ };
548553
549554 return $ propery_data ;
550555 }
@@ -590,8 +595,8 @@ private function getTags(): array
590595 return $ return ;
591596 }
592597
593- private function refIdFromType (string $ type ): string {
598+ private function refIdFromType (string $ type ): string
599+ {
594600 return str_replace (' ' , '_ ' , $ type );
595601 }
596-
597602}
0 commit comments