33namespace Mpociot \ApiDoc \Tools ;
44
55use Illuminate \Routing \Route ;
6- use Illuminate \Support \Arr ;
76use League \Flysystem \Adapter \Local ;
87use League \Flysystem \Filesystem ;
98use Symfony \Component \Console \Output \ConsoleOutput ;
@@ -90,7 +89,7 @@ public static function dumpException(\Exception $e)
9089
9190 public static function deleteDirectoryAndContents ($ dir )
9291 {
93- $ dir = ltrim ($ dir , " / " );
92+ $ dir = ltrim ($ dir , ' / ' );
9493 $ adapter = new Local (realpath (__DIR__ . '/../../ ' ));
9594 $ fs = new Filesystem ($ adapter );
9695 $ fs ->deleteDir ($ dir );
@@ -104,7 +103,7 @@ public static function deleteDirectoryAndContents($dir)
104103 * @throws \Symfony\Component\VarExporter\Exception\ExceptionInterface
105104 *
106105 */
107- public static function printPhpValue ($ value , $ indentationLevel = 0 )
106+ public static function printPhpValue ($ value , int $ indentationLevel = 0 ): string
108107 {
109108 $ output = VarExporter::export ($ value );
110109 // Padding with x spaces so they align
@@ -120,7 +119,7 @@ public static function printPhpValue($value, $indentationLevel = 0)
120119
121120 public static function printQueryParamsAsString (array $ cleanQueryParams ): string
122121 {
123- $ qs = "" ;
122+ $ qs = '' ;
124123 foreach ($ cleanQueryParams as $ parameter => $ value ) {
125124 $ paramName = urlencode ($ parameter );
126125
@@ -129,14 +128,13 @@ public static function printQueryParamsAsString(array $cleanQueryParams): string
129128 } else {
130129 if (array_keys ($ value )[0 ] === 0 ) {
131130 // List query param (eg filter[]=haha should become "filter[]": "haha")
132- $ qs .= "$ paramName " . " []= " . urlencode ($ value [0 ]) . " & " ;
131+ $ qs .= "$ paramName " . ' []= ' . urlencode ($ value [0 ]) . ' & ' ;
133132 } else {
134133 // Hash query param (eg filter[name]=john should become "filter[name]": "john")
135134 foreach ($ value as $ item => $ itemValue ) {
136- $ qs .= "$ paramName " . " [ " . urlencode ($ item ) . " ]= " . urlencode ($ itemValue ) . " & " ;
135+ $ qs .= "$ paramName " . ' [ ' . urlencode ($ item ) . ' ]= ' . urlencode ($ itemValue ) . ' & ' ;
137136 }
138137 }
139-
140138 }
141139 }
142140
@@ -156,23 +154,23 @@ public static function printQueryParamsAsKeyValue(
156154 foreach ($ cleanQueryParams as $ parameter => $ value ) {
157155 if (!is_array ($ value )) {
158156 $ output .= str_repeat (" " , $ spacesIndentation );
159- $ output .= "$ quote$ parameter$ quote$ delimiter $ quote$ value$ quote, \n" ;
157+ $ output .= "$ quote$ parameter$ quote$ delimiter $ quote$ value$ quote, \n" ;
160158 } else {
161159 if (array_keys ($ value )[0 ] === 0 ) {
162160 // List query param (eg filter[]=haha should become "filter[]": "haha")
163161 $ output .= str_repeat (" " , $ spacesIndentation );
164- $ output .= "$ quote$ parameter " . "[] $ quote$ delimiter $ quote$ value [0 ]$ quote, \n" ;
162+ $ output .= "$ quote$ parameter " . "[] $ quote$ delimiter $ quote$ value [0 ]$ quote, \n" ;
165163 } else {
166164 // Hash query param (eg filter[name]=john should become "filter[name]": "john")
167165 foreach ($ value as $ item => $ itemValue ) {
168166 $ output .= str_repeat (" " , $ spacesIndentation );
169- $ output .= "$ quote$ parameter " . "[ $ item] $ quote$ delimiter $ quote$ itemValue$ quote, \n" ;
167+ $ output .= "$ quote$ parameter " . "[ $ item] $ quote$ delimiter $ quote$ itemValue$ quote, \n" ;
170168 }
171169 }
172170
173171 }
174172 }
175173
176- return $ output. str_repeat (" " , $ closingBraceIndentation ). "{$ braces [1 ]}" ;
174+ return $ output . str_repeat (" " , $ closingBraceIndentation ) . "{$ braces [1 ]}" ;
177175 }
178176}
0 commit comments