Implement changes after review by stof.

- Use camelCase variable names.
- Set 3rd argument of http_build_query
- Remove obsolete checks
main
Stefan Grootscholten 8 years ago
parent 5dbdefdd72
commit 4377ba2bcb

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

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

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

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

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

Loading…
Cancel
Save