Completed
Push — master ( 3601fa...98b6df )
by Lorenzo
07:57
created
src/ComposerSecurityCheckServiceProvider.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     /**
51 51
      * Get the services provided by the provider.
52 52
      *
53
-     * @return array
53
+     * @return string[]
54 54
      */
55 55
     public function provides()
56 56
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace Padosoft\LaravelComposerSecurity;
3 3
 
4 4
 use Illuminate\Support\ServiceProvider;
5
-use GuzzleHttp\Client;
6 5
 
7 6
 class ComposerSecurityCheckServiceProvider extends ServiceProvider
8 7
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     public function boot()
22 22
     {
23 23
         $this->publishes([
24
-            __DIR__ . '/config/composer-security-check.php' => config_path('composer-security-check.php'),
24
+            __DIR__.'/config/composer-security-check.php' => config_path('composer-security-check.php'),
25 25
         ], 'config');
26 26
 
27
-        $this->loadViewsFrom(__DIR__ . '/views', 'composer-security-check');
27
+        $this->loadViewsFrom(__DIR__.'/views', 'composer-security-check');
28 28
 
29 29
         $this->publishes([
30
-            __DIR__ . '/views' => base_path('resources/views/vendor/composer-security-check'),
30
+            __DIR__.'/views' => base_path('resources/views/vendor/composer-security-check'),
31 31
         ]);
32 32
     }
33 33
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function register()
40 40
     {
41 41
         $this->app['command.composer-security:check'] = $this->app->share(
42
-            function ($app) {
42
+            function($app) {
43 43
                 return new ComposerSecurityCheck(new client);
44 44
             }
45 45
         );
Please login to merge, or discard this patch.
src/FileHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function findFiles($path, $fileName)
15 15
     {
16
-        if ($path=='') {
16
+        if ($path == '') {
17 17
             $path = base_path();
18 18
         }
19 19
 
20 20
         if (is_dir($path)) {
21
-            $path=str_finish($path, '/');
21
+            $path = str_finish($path, '/');
22 22
 
23 23
         }
24 24
         $path .= $fileName;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
         $p = explode(",", str_replace('\\', '/', $path));
37 37
 
38
-        $pathList = array_map(function ($item) {
38
+        $pathList = array_map(function($item) {
39 39
             return str_finish($item, '/');
40 40
         },
41 41
             $p
Please login to merge, or discard this patch.
src/config/composer-security-check.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,4 +12,4 @@
 block discarded – undo
12 12
     'mailFromName' => env('SECURITY_CHECK_MESSAGE_FROM_NAME', 'Info Example'),
13 13
     'mailViewName' => env('SECURITY_CHECK_MAIL_VIEW_NAME', 'composer-security-check::mail'),
14 14
     'logFilePath' => env('SECURITY_CHECK_LOG_FILE_PATH', storage_path().'/composersecurityCheck.log')
15
- );
15
+    );
Please login to merge, or discard this patch.
src/SensiolabHelper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     /**
130 130
      * @param $key
131 131
      * @param $vulnerability
132
-     * @param $tuttoOk
132
+     * @param boolean $tuttoOk
133 133
      * @return array
134 134
      */
135 135
     public function checkResponse($key, $vulnerability, $tuttoOk)
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     /**
147
-     * @param            $msg
147
+     * @param            string $msg
148 148
      * @param bool|false $error
149 149
      */
150 150
     private function addVerboseLog($msg, $error = false)
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 
9 9
 namespace Padosoft\LaravelComposerSecurity;
10 10
 
11
-use Illuminate\Console\Command;
12 11
 use GuzzleHttp\Client;
12
+use Illuminate\Console\Command;
13 13
 
14 14
 class SensiolabHelper
15 15
 {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,19 +42,19 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function getSensiolabVulnerabilties($fileLock)
44 44
     {
45
-        $this->addVerboseLog('Send request to sensiolab: <info>' . $fileLock . '</info>');
45
+        $this->addVerboseLog('Send request to sensiolab: <info>'.$fileLock.'</info>');
46 46
 
47
-        $debug = false;//set to true to log into console output
47
+        $debug = false; //set to true to log into console output
48 48
         $headers = [
49 49
             //OPTIONS
50 50
             'allow_redirects' => [
51
-                'max' => 3,        // allow at most 10 redirects.
52
-                'strict' => true,      // use "strict" RFC compliant redirects.
53
-                'referer' => true,      // add a Referer header
51
+                'max' => 3, // allow at most 10 redirects.
52
+                'strict' => true, // use "strict" RFC compliant redirects.
53
+                'referer' => true, // add a Referer header
54 54
                 'protocols' => ['http', 'https'], // only allow http and https URLs
55 55
                 'track_redirects' => false
56 56
             ],
57
-            'connect_timeout' => 20,//Use 0 to wait connection indefinitely
57
+            'connect_timeout' => 20, //Use 0 to wait connection indefinitely
58 58
             'timeout' => 30, //Use 0 to wait response indefinitely
59 59
             'debug' => $debug,
60 60
             //HEADERS
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
             $responseBody = $iResponse->getBody()->getContents();
77 77
             $response = json_decode($responseBody, true);
78 78
         } catch (\GuzzleHttp\Exception\ClientException $e) {
79
-            $this->command->error("ClientException!\nMessage: " . $e->getMessage());
79
+            $this->command->error("ClientException!\nMessage: ".$e->getMessage());
80 80
             $colorTag = $this->getColorTagForStatusCode($e->getResponse()->getStatusCode());
81
-            $this->command->line("HTTP StatusCode: <{$colorTag}>" . $e->getResponse()->getStatusCode() . "<{$colorTag}>");
81
+            $this->command->line("HTTP StatusCode: <{$colorTag}>".$e->getResponse()->getStatusCode()."<{$colorTag}>");
82 82
             $this->printMessage($e->getResponse());
83 83
             $this->printMessage($e->getRequest());
84 84
         } catch (\GuzzleHttp\Exception\RequestException $e) {
85
-            $this->command->error("RequestException!\nMessage: " . $e->getMessage());
85
+            $this->command->error("RequestException!\nMessage: ".$e->getMessage());
86 86
             $this->printMessage($e->getRequest());
87 87
             if ($e->hasResponse()) {
88 88
                 $colorTag = $this->getColorTagForStatusCode($e->getResponse()->getStatusCode());
89
-                $this->command->line("HTTP StatusCode: <{$colorTag}>" . $e->getResponse()->getStatusCode() . "<{$colorTag}>");
89
+                $this->command->line("HTTP StatusCode: <{$colorTag}>".$e->getResponse()->getStatusCode()."<{$colorTag}>");
90 90
                 $this->printMessage($e->getResponse());
91 91
             }
92 92
         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 'advisories' => $data2["title"]
120 120
             ];
121 121
 
122
-            $this->addVerboseLog($data['name'] . " " . $data['version'] . " " . $data2["title"], true);
122
+            $this->addVerboseLog($data['name']." ".$data['version']." ".$data2["title"], true);
123 123
             $this->tableVulnerabilities[] = $dataTable;
124 124
         }
125 125
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $this->command->info("$type:");
175 175
         $headers = '';
176 176
         foreach ($message->getHeaders() as $name => $values) {
177
-            $headers .= $name . ': ' . implode(', ', $values) . "\r\n";
177
+            $headers .= $name.': '.implode(', ', $values)."\r\n";
178 178
         }
179 179
         $this->command->comment($headers);
180 180
         if ($type == 'REQUEST') {
Please login to merge, or discard this patch.
src/ComposerSecurityCheck.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     private function hardWork($argument, $option)
83 83
     {
84 84
         $path = $argument['path'];
85
-        $this->line('path: <info>' . $path . '</info>.\nCheck composer.lock files...');
85
+        $this->line('path: <info>'.$path.'</info>.\nCheck composer.lock files...');
86 86
         $lockFiles = $this->findFilesComposerLock($path);
87
-        $this->line('Find <info>' . count($lockFiles) . '</info> composer.lock files.');
87
+        $this->line('Find <info>'.count($lockFiles).'</info> composer.lock files.');
88 88
 
89 89
         $this->tableVulnerabilities = [];
90 90
         $tuttoOk = true;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         foreach ($lockFiles as $fileLock) {
96 96
 
97
-            $this->line("Analizing <info>" . ($numLock + 1) . "</info> di <info>" . count($lockFiles) . "</info>");
97
+            $this->line("Analizing <info>".($numLock + 1)."</info> di <info>".count($lockFiles)."</info>");
98 98
 
99 99
             $tuttoOk = $this->checkFile($fileLock, $whitelist);
100 100
 
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 
118 118
         $nomailok_bool = false;
119 119
 
120
-        if ($nomailok!='' && strtolower($nomailok)=='true') {
120
+        if ($nomailok != '' && strtolower($nomailok) == 'true') {
121 121
             $nomailok_bool = true;
122 122
         }
123 123
 
124 124
         //send email
125
-        if(!$nomailok_bool || !$tuttoOk) {
125
+        if (!$nomailok_bool || !$tuttoOk) {
126 126
             $this->sendEmail($mail, $tuttoOk);
127 127
         }
128 128
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
         $file = new FileHelper();
169 169
         $lockFiles = array();
170 170
         foreach ($file->adjustPath($path) as $item) {
171
-            $lockFiles = array_merge($lockFiles,$file->findFiles($item, 'composer.lock'));
171
+            $lockFiles = array_merge($lockFiles, $file->findFiles($item, 'composer.lock'));
172 172
         }
173 173
 
174 174
 
175
-        if(!is_array($lockFiles)){
175
+        if (!is_array($lockFiles)) {
176 176
             $lockFiles = array();
177 177
         }
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         if (count($response) == 0) {
206 206
             return true;
207 207
         }
208
-        $this->error("Trovate " . count($response) . " vulnerabilita' in $fileLock");
208
+        $this->error("Trovate ".count($response)." vulnerabilita' in $fileLock");
209 209
 
210 210
         $tuttoOk = in_array(rtrim(str_replace('\\', '/', $fileLock), 'composer.lock'), $whitelist);
211 211
 
Please login to merge, or discard this patch.
src/MailHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function sendEmail($tuttoOk, $mail, $vul)
45 45
     {
46
-        $soggetto=Config::get('composer-security-check.mailSubjectSuccess');
46
+        $soggetto = Config::get('composer-security-check.mailSubjectSuccess');
47 47
 
48 48
         if (!$tuttoOk) {
49
-            $soggetto=Config::get('composer-security-check.mailSubjetcAlarm');
49
+            $soggetto = Config::get('composer-security-check.mailSubjetcAlarm');
50 50
         }
51 51
 
52 52
         $validator = Validator::make(['email' => $mail], [
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         Mail::send(
62 62
             Config::get('composer-security-check.mailViewName'),
63 63
             ['vul' => $vul],
64
-            function ($message) use ($mail, $soggetto) {
64
+            function($message) use ($mail, $soggetto) {
65 65
                 $message->from(
66 66
                     Config::get('composer-security-check.mailFrom'),
67 67
                     Config::get('composer-security-check.mailFromName')
Please login to merge, or discard this patch.