@@ -84,13 +84,14 @@ public function suggestComposerCommand($result, CommandData $commandData)
8484     * 
8585     * @throws \Exception 
8686     */ 
87-     protected  function  fetchAdvisoryComposerJson () {
87+     protected  function  fetchAdvisoryComposerJson ()
88+     {
8889        try  {
8990            $ response_body  = file_get_contents ('https://raw.githubusercontent.com/drupal-composer/drupal-security-advisories/8.x/composer.json ' );
9091        } catch  (Exception   $ e ) {
9192            throw  new  Exception ("Unable to fetch drupal-security-advisories information. " );
9293        }
93-         $ security_advisories_composer_json  = json_decode ($ response_body , TRUE );
94+         $ security_advisories_composer_json  = json_decode ($ response_body , true );
9495        return  $ security_advisories_composer_json ;
9596    }
9697
@@ -101,18 +102,24 @@ protected function fetchAdvisoryComposerJson() {
101102     * 
102103     * @throws \Exception 
103104     */ 
104-     protected  function  loadSiteComposerLock () {
105+     protected  function  loadSiteComposerLock ()
106+     {
105107        $ composer_root  = Drush::bootstrapManager ()->getComposerRoot ();
106-         $ composer_lock_file_name  = getenv ('COMPOSER ' ) ? str_replace ('.json ' , '' ,
107-             getenv ('COMPOSER ' )) : 'composer ' ;
108+         $ composer_lock_file_name  = getenv ('COMPOSER ' ) ? str_replace (
109+             '.json ' ,
110+             '' ,
111+             getenv ('COMPOSER ' )
112+         ) : 'composer ' ;
108113        $ composer_lock_file_name  .= '.lock ' ;
109-         $ composer_lock_file_path  = Path::join ($ composer_root ,
110-             $ composer_lock_file_name );
114+         $ composer_lock_file_path  = Path::join (
115+             $ composer_root ,
116+             $ composer_lock_file_name
117+         );
111118        if  (!file_exists ($ composer_lock_file_path )) {
112119            throw  new  Exception ("Cannot find  $ composer_lock_file_path! " );
113120        }
114121        $ composer_lock_contents  = file_get_contents ($ composer_lock_file_path );
115-         $ composer_lock_data  = json_decode ($ composer_lock_contents , TRUE );
122+         $ composer_lock_data  = json_decode ($ composer_lock_contents , true );
116123        if  (!array_key_exists ('packages ' , $ composer_lock_data )) {
117124            throw  new  Exception ("No packages were found in  $ composer_lock_file_path! Contents: \n  $ composer_lock_contents " );
118125        }
@@ -158,8 +165,10 @@ public static function determineUpdatesFromConstraint(
158165        // Only parse constraints that follow pattern like "<1.0.0". 
159166        if  (substr ($ conflict_constraint , 0 , 1 ) == '< ' ) {
160167            $ min_version  = substr ($ conflict_constraint , 1 );
161-             if  (Comparator::lessThan ($ package ['version ' ],
162-                 $ min_version )) {
168+             if  (Comparator::lessThan (
169+                 $ package ['version ' ],
170+                 $ min_version
171+             )) {
163172                return  [
164173                    'name '  => $ name ,
165174                    'version '  => $ package ['version ' ],
@@ -168,13 +177,16 @@ public static function determineUpdatesFromConstraint(
168177                    'min-version '  => $ min_version ,
169178                ];
170179            }
171-         }
172-         // Compare exact versions that are insecure. 
173-         elseif  (preg_match ('/^[[:digit:]](?![-*><=~ ])/ ' ,
174-             $ conflict_constraint )) {
180+         } // Compare exact versions that are insecure. 
181+         elseif  (preg_match (
182+             '/^[[:digit:]](?![-*><=~ ])/ ' ,
183+             $ conflict_constraint
184+         )) {
175185            $ exact_version  = $ conflict_constraint ;
176-             if  (Comparator::equalTo ($ package ['version ' ],
177-                 $ exact_version )) {
186+             if  (Comparator::equalTo (
187+                 $ package ['version ' ],
188+                 $ exact_version
189+             )) {
178190                $ version_parts  = explode ('. ' , $ package ['version ' ]);
179191                if  (count ($ version_parts ) == 3 ) {
180192                    $ version_parts [2 ]++;
@@ -209,11 +221,16 @@ protected function registerPackageSecurityUpdates(
209221    ) {
210222        if  (empty ($ this  ->securityUpdates [$ name ]) &&
211223            !empty ($ security_advisories_composer_json ['conflict ' ][$ name ])) {
212-             $ conflict_constraints  = explode (', ' ,
213-                 $ security_advisories_composer_json ['conflict ' ][$ name ]);
224+             $ conflict_constraints  = explode (
225+                 ', ' ,
226+                 $ security_advisories_composer_json ['conflict ' ][$ name ]
227+             );
214228            foreach  ($ conflict_constraints  as  $ conflict_constraint ) {
215-                 $ available_update  = $ this  ->determineUpdatesFromConstraint ($ conflict_constraint ,
216-                     $ package , $ name );
229+                 $ available_update  = $ this  ->determineUpdatesFromConstraint (
230+                     $ conflict_constraint ,
231+                     $ package ,
232+                     $ name
233+                 );
217234                if  ($ available_update ) {
218235                    $ this  ->securityUpdates [$ name ] = $ available_update ;
219236                }
0 commit comments