Skip to content

Commit 2f39f9b

Browse files
committed
fix style and scrutinizer advices.
1 parent 3c1831d commit 2f39f9b

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

src/ComposerSecurityCheckServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function ($app) {
5050
/**
5151
* Get the services provided by the provider.
5252
*
53-
* @return array
53+
* @return string[]
5454
*/
5555
public function provides()
5656
{

src/SensiolabHelper.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ public function getSensiolabVulnerabilties($fileLock)
8080
$colorTag = $this->getColorTagForStatusCode($e->getResponse()->getStatusCode());
8181
$this->command->line("HTTP StatusCode: <{$colorTag}>" . $e->getResponse()->getStatusCode() . "<{$colorTag}>");
8282
$resp = $e->getResponse();
83-
$this->printMessage($resp === null ? '' : $resp);
83+
if ($resp != null) {
84+
$this->printMessage($resp);
85+
}
8486
$this->printMessage($e->getRequest());
8587
} catch (\GuzzleHttp\Exception\RequestException $e) {
8688
$this->command->error("RequestException!\nMessage: " . $e->getMessage());
@@ -89,7 +91,9 @@ public function getSensiolabVulnerabilties($fileLock)
8991
$colorTag = $this->getColorTagForStatusCode($e->getResponse()->getStatusCode());
9092
$this->command->line("HTTP StatusCode: <{$colorTag}>" . $e->getResponse()->getStatusCode() . "<{$colorTag}>");
9193
$resp = $e->getResponse();
92-
$this->printMessage($resp === null ? '' : $resp);
94+
if ($resp != null) {
95+
$this->printMessage($resp);
96+
}
9397
}
9498
}
9599
return $response;
@@ -131,7 +135,7 @@ public function parseVulnerability($name, $vulnerability)
131135
/**
132136
* @param $key
133137
* @param $vulnerability
134-
* @param $tuttoOk
138+
* @param bool $tuttoOk
135139
* @return array
136140
*/
137141
public function checkResponse($key, $vulnerability, $tuttoOk)
@@ -146,7 +150,7 @@ public function checkResponse($key, $vulnerability, $tuttoOk)
146150
}
147151

148152
/**
149-
* @param $msg
153+
* @param string $msg
150154
* @param bool|false $error
151155
*/
152156
private function addVerboseLog($msg, $error = false)
@@ -169,14 +173,13 @@ private function addVerboseLog($msg, $error = false)
169173
private function printMessage(\Psr\Http\Message\MessageInterface $message)
170174
{
171175
$type = '';
176+
$body = '';
172177
if (is_a($message, '\Psr\Http\Message\RequestInterface')) {
173178
$type = 'REQUEST';
174179
$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();
180183
}
181184
$this->command->info("$type:");
182185
$headers = '';
@@ -186,10 +189,8 @@ private function printMessage(\Psr\Http\Message\MessageInterface $message)
186189
$this->command->comment($headers);
187190
if ($type == 'REQUEST') {
188191
$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);
193194
}
194195
}
195196

src/config/composer-security-check.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
'mailFrom' => env('SECURITY_CHECK_MESSAGE_FROM', '[email protected]'),
1212
'mailFromName' => env('SECURITY_CHECK_MESSAGE_FROM_NAME', 'Info Example'),
1313
'mailViewName' => env('SECURITY_CHECK_MAIL_VIEW_NAME', 'composer-security-check::mail'),
14-
'logFilePath' => env('SECURITY_CHECK_LOG_FILE_PATH', storage_path().'/logs/composersecurityCheck.log')
15-
);
14+
'logFilePath' => env('SECURITY_CHECK_LOG_FILE_PATH', storage_path() . '/logs/composersecurityCheck.log')
15+
);

0 commit comments

Comments
 (0)