@@ -80,7 +80,9 @@ public function getSensiolabVulnerabilties($fileLock)
80
80
$ colorTag = $ this ->getColorTagForStatusCode ($ e ->getResponse ()->getStatusCode ());
81
81
$ this ->command ->line ("HTTP StatusCode: < {$ colorTag }> " . $ e ->getResponse ()->getStatusCode () . "< {$ colorTag }> " );
82
82
$ resp = $ e ->getResponse ();
83
- $ this ->printMessage ($ resp === null ? '' : $ resp );
83
+ if ($ resp != null ) {
84
+ $ this ->printMessage ($ resp );
85
+ }
84
86
$ this ->printMessage ($ e ->getRequest ());
85
87
} catch (\GuzzleHttp \Exception \RequestException $ e ) {
86
88
$ this ->command ->error ("RequestException! \nMessage: " . $ e ->getMessage ());
@@ -89,7 +91,9 @@ public function getSensiolabVulnerabilties($fileLock)
89
91
$ colorTag = $ this ->getColorTagForStatusCode ($ e ->getResponse ()->getStatusCode ());
90
92
$ this ->command ->line ("HTTP StatusCode: < {$ colorTag }> " . $ e ->getResponse ()->getStatusCode () . "< {$ colorTag }> " );
91
93
$ resp = $ e ->getResponse ();
92
- $ this ->printMessage ($ resp === null ? '' : $ resp );
94
+ if ($ resp != null ) {
95
+ $ this ->printMessage ($ resp );
96
+ }
93
97
}
94
98
}
95
99
return $ response ;
@@ -131,7 +135,7 @@ public function parseVulnerability($name, $vulnerability)
131
135
/**
132
136
* @param $key
133
137
* @param $vulnerability
134
- * @param $tuttoOk
138
+ * @param bool $tuttoOk
135
139
* @return array
136
140
*/
137
141
public function checkResponse ($ key , $ vulnerability , $ tuttoOk )
@@ -146,7 +150,7 @@ public function checkResponse($key, $vulnerability, $tuttoOk)
146
150
}
147
151
148
152
/**
149
- * @param $msg
153
+ * @param string $msg
150
154
* @param bool|false $error
151
155
*/
152
156
private function addVerboseLog ($ msg , $ error = false )
@@ -169,14 +173,13 @@ private function addVerboseLog($msg, $error = false)
169
173
private function printMessage (\Psr \Http \Message \MessageInterface $ message )
170
174
{
171
175
$ type = '' ;
176
+ $ body = '' ;
172
177
if (is_a ($ message , '\Psr\Http\Message\RequestInterface ' )) {
173
178
$ type = 'REQUEST ' ;
174
179
$ body = $ message ->getBody ();
175
- } else {
176
- if (is_a ($ message , '\Psr\Http\Message\ResponseInterface ' )) {
177
- $ type = 'RESPONSE ' ;
178
- $ body = $ message ->getBody ()->getContents ();
179
- }
180
+ } elseif (is_a ($ message , '\Psr\Http\Message\ResponseInterface ' )) {
181
+ $ type = 'RESPONSE ' ;
182
+ $ body = $ message ->getBody ()->getContents ();
180
183
}
181
184
$ this ->command ->info ("$ type: " );
182
185
$ headers = '' ;
@@ -186,10 +189,8 @@ private function printMessage(\Psr\Http\Message\MessageInterface $message)
186
189
$ this ->command ->comment ($ headers );
187
190
if ($ type == 'REQUEST ' ) {
188
191
$ this ->command ->comment ($ body );
189
- } else {
190
- if ($ type == 'RESPONSE ' ) {
191
- $ this ->command ->comment ($ body );
192
- }
192
+ } elseif ($ type == 'RESPONSE ' ) {
193
+ $ this ->command ->comment ($ body );
193
194
}
194
195
}
195
196
0 commit comments