@@ -79,15 +79,15 @@ public function getSensiolabVulnerabilties($fileLock)
7979 $ this ->command ->error ("ClientException! \nMessage: " . $ e ->getMessage ());
8080 $ colorTag = $ this ->getColorTagForStatusCode ($ e ->getResponse ()->getStatusCode ());
8181 $ this ->command ->line ("HTTP StatusCode: < {$ colorTag }> " . $ e ->getResponse ()->getStatusCode () . "< {$ colorTag }> " );
82- $ this ->printMessage ($ e ->getResponse ());
82+ $ this ->printMessage ($ e ->getResponse () === null ? '' : $ e -> getResponse () );
8383 $ this ->printMessage ($ e ->getRequest ());
8484 } catch (\GuzzleHttp \Exception \RequestException $ e ) {
8585 $ this ->command ->error ("RequestException! \nMessage: " . $ e ->getMessage ());
8686 $ this ->printMessage ($ e ->getRequest ());
8787 if ($ e ->hasResponse ()) {
8888 $ colorTag = $ this ->getColorTagForStatusCode ($ e ->getResponse ()->getStatusCode ());
8989 $ this ->command ->line ("HTTP StatusCode: < {$ colorTag }> " . $ e ->getResponse ()->getStatusCode () . "< {$ colorTag }> " );
90- $ this ->printMessage ($ e ->getResponse ());
90+ $ this ->printMessage ($ e ->getResponse () === null ? '' : $ e -> getResponse () );
9191 }
9292 }
9393 return $ response ;
@@ -162,14 +162,19 @@ private function addVerboseLog($msg, $error = false)
162162 /**
163163 * @param \Psr\Http\Message\MessageInterface $message
164164 *
165+ * @throws \RuntimeException
165166 */
166167 private function printMessage (\Psr \Http \Message \MessageInterface $ message )
167168 {
168169 $ type = '' ;
169170 if (is_a ($ message , '\Psr\Http\Message\RequestInterface ' )) {
170171 $ type = 'REQUEST ' ;
171- } else if (is_a ($ message , '\Psr\Http\Message\ResponseInterface ' )) {
172- $ type = 'RESPONSE ' ;
172+ $ body = $ message ->getBody ();
173+ } else {
174+ if (is_a ($ message , '\Psr\Http\Message\ResponseInterface ' )) {
175+ $ type = 'RESPONSE ' ;
176+ $ body = $ message ->getBody ()->getContents ();
177+ }
173178 }
174179 $ this ->command ->info ("$ type: " );
175180 $ headers = '' ;
@@ -178,9 +183,11 @@ private function printMessage(\Psr\Http\Message\MessageInterface $message)
178183 }
179184 $ this ->command ->comment ($ headers );
180185 if ($ type == 'REQUEST ' ) {
181- $ this ->command ->comment ($ message ->getBody ());
182- } else if ($ type == 'RESPONSE ' ) {
183- $ this ->command ->comment ($ message ->getBody ()->getContents ());
186+ $ this ->command ->comment ($ body );
187+ } else {
188+ if ($ type == 'RESPONSE ' ) {
189+ $ this ->command ->comment ($ body );
190+ }
184191 }
185192 }
186193
0 commit comments