@@ -50,7 +50,7 @@ |
||
| 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 | { |
@@ -2,7 +2,6 @@ |
||
| 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 | { |
@@ -39,7 +39,7 @@ |
||
| 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 | ); |
@@ -117,12 +117,12 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -44,17 +44,17 @@ |
||
| 44 | 44 | { |
| 45 | 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 |
@@ -13,12 +13,12 @@ discard block |
||
| 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 |
||
| 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 |
@@ -12,4 +12,4 @@ |
||
| 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 | + ); |
|
@@ -11,5 +11,5 @@ |
||
| 11 | 11 | 'mailFrom' => env('SECURITY_CHECK_MESSAGE_FROM', '[email protected]'), |
| 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 | - 'logFilePath' => env('SECURITY_CHECK_LOG_FILE_PATH', storage_path().'/logs/composersecurityCheck.log') |
|
| 14 | + 'logFilePath' => env('SECURITY_CHECK_LOG_FILE_PATH', storage_path() . '/logs/composersecurityCheck.log') |
|
| 15 | 15 | ); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: Alessandro |
|
| 5 | - * Date: 03/12/2015 |
|
| 6 | - * Time: 17:25 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: Alessandro |
|
| 5 | + * Date: 03/12/2015 |
|
| 6 | + * Time: 17:25 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Padosoft\LaravelComposerSecurity; |
| 10 | 10 | |
@@ -43,25 +43,25 @@ |
||
| 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], [ |
| 53 | 53 | 'email' => 'required|email', |
| 54 | 54 | ]); |
| 55 | 55 | if ($validator->fails()) { |
| 56 | - $this->command->error('No valid email passed: '.$mail.'. Mail will not be sent.'); |
|
| 56 | + $this->command->error('No valid email passed: ' . $mail . '. Mail will not be sent.'); |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | - $this->command->line('Send email to <info>'.$mail.'</info>'); |
|
| 59 | + $this->command->line('Send email to <info>' . $mail . '</info>'); |
|
| 60 | 60 | |
| 61 | 61 | Mail::send( |
| 62 | 62 | Config::get('composer-security-check.mailViewName'), |
| 63 | 63 | ['vul' => $vul], |
| 64 | - function (Message $message) use ($mail, $soggetto) { |
|
| 64 | + function(Message $message) use ($mail, $soggetto) { |
|
| 65 | 65 | $message->from( |
| 66 | 66 | Config::get('composer-security-check.mailFrom'), |
| 67 | 67 | Config::get('composer-security-check.mailFromName') |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * User: Mathias Grimm <[email protected]> |
|
| 4 | - * Date: 07/02/2016 |
|
| 5 | - * Time: 18:34. |
|
| 6 | - */ |
|
| 3 | + * User: Mathias Grimm <[email protected]> |
|
| 4 | + * Date: 07/02/2016 |
|
| 5 | + * Time: 18:34. |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | return [ |
| 9 | 9 | 'SECURITY_CHECK_SUBJECT_SUCCESS' => 'required', |