Explorar el Código

Implement changes after review by stof.

- Use camelCase variable names.
- Set 3rd argument of http_build_query
- Remove obsolete checks
Stefan Grootscholten hace 8 años
padre
commit
4377ba2bcb

+ 9 - 3
src/Composer/Repository/Vcs/BitbucketDriver.php

@@ -86,7 +86,9 @@ abstract class BitbucketDriver extends VcsDriver
             $this->owner,
             $this->repository,
             http_build_query(
-                array('fields' => '-project,-owner')
+                array('fields' => '-project,-owner'),
+                null,
+                '&'
             )
         );
 
@@ -266,7 +268,9 @@ abstract class BitbucketDriver extends VcsDriver
                         'pagelen' => 100,
                         'fields' => 'values.name,values.target.hash,next',
                         'sort' => '-target.date'
-                    )
+                    ),
+                    null,
+                    '&'
                 )
             );
             $hasNext = true;
@@ -308,7 +312,9 @@ abstract class BitbucketDriver extends VcsDriver
                         'pagelen' => 100,
                         'fields' => 'values.name,values.target.hash,next',
                         'sort' => '-target.date'
-                    )
+                    ),
+                    null,
+                    '&'
                 )
             );
             $hasNext = true;

+ 2 - 2
src/Composer/Repository/Vcs/GitBitbucketDriver.php

@@ -43,8 +43,8 @@ class GitBitbucketDriver extends BitbucketDriver
                 );
             }
 
-            $main_branch_data = $this->getMainBranchData();
-            $this->rootIdentifier = !empty($main_branch_data['name']) ? $main_branch_data['name'] : 'master';
+            $mainBranchData = $this->getMainBranchData();
+            $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
         }
 
         return $this->rootIdentifier;

+ 2 - 2
src/Composer/Repository/Vcs/HgBitbucketDriver.php

@@ -43,8 +43,8 @@ class HgBitbucketDriver extends BitbucketDriver
                 );
             }
 
-            $main_branch_data = $this->getMainBranchData();
-            $this->rootIdentifier = !empty($main_branch_data['name']) ? $main_branch_data['name'] : 'default';
+            $mainBranchData = $this->getMainBranchData();
+            $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
         }
 
         return $this->rootIdentifier;

+ 1 - 3
src/Composer/Util/Bitbucket.php

@@ -227,9 +227,7 @@ class Bitbucket
     {
         $authConfig = $this->config->get('bitbucket-oauth');
 
-        if (empty($authConfig) ||
-            ! isset($authConfig[$originUrl]) ||
-            ! isset($authConfig[$originUrl]['access-token']) ||
+        if (! isset($authConfig[$originUrl]['access-token']) ||
             ! isset($authConfig[$originUrl]['access-token-expiration']) ||
             time() > $authConfig[$originUrl]['access-token-expiration']
         ) {

+ 5 - 5
src/Composer/Util/Git.php

@@ -122,17 +122,17 @@ class Git
 
                     if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
                         $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
-                        $access_token = $bitbucketUtil->getToken();
-                        $this->io->setAuthentication($match[1], 'x-token-auth', $access_token);
+                        $accessToken = $bitbucketUtil->getToken();
+                        $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
                     }
                 } else { //We're authenticating with a locally stored consumer.
                     $auth = $this->io->getAuthentication($match[1]);
 
                     //We already have an access_token from a previous request.
                     if ($auth['username'] !== 'x-token-auth') {
-                        $access_token = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
-                        if (! empty($access_token)) {
-                            $this->io->setAuthentication($match[1], 'x-token-auth', $access_token);
+                        $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
+                        if (! empty($accessToken)) {
+                            $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
                         }
                     }
                 }