Skip to content

Commit

Permalink
Remove old unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sstok committed Jul 30, 2016
1 parent 427ea3d commit fb4c7bf
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 141 deletions.
23 changes: 0 additions & 23 deletions src/Adapter/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ public function authenticate();
*/
public function isAuthenticated();

/**
* Returns the URL for generating a token.
*
* If the adapter doesn't support tokens,
* this will return null instead.
*
* @return null|string
*/
public function getTokenGenerationUrl();

/**
* Creates a fork from upstream and returns an array
* with the forked url.
Expand Down Expand Up @@ -201,7 +191,6 @@ public function openPullRequest($base, $head, $subject, $body, array $parameters
* "updated_at": "DateTime Object"
* "user": "username"
* "assignee": "username"
* "merge_commit": "e5bd3914e2e596debea16f433f57875b5b90bcd6"
* "merged": false
* "merged_by": "username"
* "head": [
Expand Down Expand Up @@ -246,18 +235,6 @@ public function getPullRequest($id);
*/
public function getPullRequestCommits($id);

/**
* Merges a pull-request by id.
*
* @param int $id
* @param string $message
*
* @throws AdapterException when merging failed
*
* @return string sha1 of the merge commit
*/
public function mergePullRequest($id, $message);

/**
* Updates the state of a pull-request by id.
*
Expand Down
10 changes: 0 additions & 10 deletions src/Adapter/IssueTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ public function authenticate();
*/
public function isAuthenticated();

/**
* Returns the URL for generating a token.
*
* If the tracker doesn't support tokens,
* this will return null instead.
*
* @return null|string
*/
public function getTokenGenerationUrl();

/**
* Opens a new issue on the issue tracker.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AdapterFactory
const SUPPORT_ISSUE_TRACKER = 'supports_issue_tracker';

/**
* @var string[]
* @var array
*/
private $adapters = [];

Expand Down
2 changes: 0 additions & 2 deletions src/Helper/TemplateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ public function getTemplate($domain, $name)
* input, then binds the parameters to the template.
*
* @param TemplateInterface $template Template to render
*
* @internal param OutputInterface $output Output from the command
*/
public function parameterize(TemplateInterface $template)
{
Expand Down
15 changes: 0 additions & 15 deletions src/ThirdParty/Bitbucket/BitbucketAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ public function isAuthenticated()
return $this->authenticated;
}

/**
* {@inheritdoc}
*/
public function getTokenGenerationUrl()
{
if (isset($this->configuration['authentication'])) {
return sprintf(
'https://bitbucket.org/account/user/%s/api',
$this->configuration['authentication']['username']
);
}

return;
}

protected function prepareParameters(array $parameters)
{
foreach ($parameters as $k => $v) {
Expand Down
23 changes: 1 addition & 22 deletions src/ThirdParty/Bitbucket/BitbucketRepoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function openPullRequest($base, $head, $subject, $body, array $parameters
],
];

if (null !== $this->getUsername() && $sourceOrg !== $this->getUsername()) {
if ($sourceOrg !== $this->getUsername()) {
$params['source']['repository'] = [
'full_name' => $sourceOrg.'/'.$this->getRepository(),
];
Expand Down Expand Up @@ -302,26 +302,6 @@ public function getPullRequestCommits($id)
return $commits;
}

/**
* {@inheritdoc}
*/
public function mergePullRequest($id, $message)
{
$response = $this->client->apiPullRequests()->accept(
$this->getUsername(),
$this->getRepository(),
$id,
['message' => $message]
);

$resultArray = json_decode($response->getContent(), true);
if ('MERGED' !== $resultArray['state']) {
throw new AdapterException($response->getContent());
}

return $resultArray['merge_commit']['hash'];
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -522,7 +502,6 @@ protected function adaptPullRequestStructure(array $pr)
'updated_at' => !empty($pr['updated_on']) ? new \DateTime($pr['updated_on']) : null,
'user' => $pr['author']['username'],
'assignee' => null, // unsupported, only multiple
'merge_commit' => $pr['merge_commit'],
'merged' => 'merged' === strtolower($pr['state']) && isset($pr['closed_by']),
'merged_by' => isset($pr['closed_by']) ? $pr['closed_by'] : '',
'head' => [
Expand Down
30 changes: 0 additions & 30 deletions src/ThirdParty/Github/GitHubAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,6 @@ public function isAuthenticated()
return is_array($this->client->api('me')->show());
}

/**
* {@inheritdoc}
*/
public function getTokenGenerationUrl()
{
return sprintf('%s/settings/applications', $this->url);
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -492,27 +484,6 @@ public function getCommitStatuses($org, $repo, $hash)
return $pager->fetchAll($this->client->api('repo')->statuses(), 'combined', [$org, $repo, $hash])['statuses'];
}

/**
* {@inheritdoc}
*/
public function mergePullRequest($id, $message)
{
$api = $this->client->api('pull_request');

$result = $api->merge(
$this->getUsername(),
$this->getRepository(),
$id,
$message
);

if (false === $result['merged']) {
throw new AdapterException('Merge failed: '.$result['message']);
}

return $result['sha'];
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -694,7 +665,6 @@ protected function adaptPullRequestStructure(array $pr)
'updated_at' => !empty($pr['updated_at']) ? new \DateTime($pr['updated_at']) : null,
'user' => $pr['user']['login'],
'assignee' => null,
'merge_commit' => null, // empty as GitHub doesn't provide this yet, merge_commit_sha is deprecated and not meant for this
'merged' => isset($pr['merged_by']) && isset($pr['merged_by']['login']),
'merged_by' => isset($pr['merged_by']) && isset($pr['merged_by']['login']) ? $pr['merged_by']['login'] : '',
'head' => [
Expand Down
8 changes: 0 additions & 8 deletions src/ThirdParty/Gitlab/Adapter/GitLabAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ public function isAuthenticated()
return is_array($this->client->api('projects')->owned());
}

/**
* {@inheritdoc}
*/
public function getTokenGenerationUrl()
{
return sprintf('%/profile/account', $this->configuration['repo_domain_url']);
}

protected static function getPagination(Response $response)
{
$header = $response->getHeader('Link');
Expand Down
10 changes: 0 additions & 10 deletions src/ThirdParty/Gitlab/Adapter/GitLabRepoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ public function getPullRequestCommits($id)
return [];
}

/**
* {@inheritdoc}
*/
public function mergePullRequest($id, $message)
{
$mr = $this->client->api('merge_requests')->show($this->getCurrentProject()->id, $id);
$mr = MergeRequest::fromArray($this->client, $this->getCurrentProject(), $mr);
$mr->merge($message);
}

/**
* {@inheritdoc}
*/
Expand Down
1 change: 0 additions & 1 deletion src/ThirdParty/Gitlab/Model/MergeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function toArray()
'updated_at' => null,
'user' => null,
'assignee' => null,
'merge_commit' => null,
'merged' => false,
'merged_by' => null,
'head' => [
Expand Down
11 changes: 0 additions & 11 deletions tests/Fixtures/Adapter/TestAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ public function authenticate()
return true;
}

/**
* {@inheritdoc}
*/
public function getTokenGenerationUrl()
{
return;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -325,7 +317,6 @@ public function openPullRequest($base, $head, $subject, $body, array $parameters
'updated_at' => new \DateTime(),
'user' => 'cordoval',
'assignee' => null,
'merge_commit' => null,
'merged' => false,
'merged_by' => null,
'head' => [
Expand Down Expand Up @@ -379,7 +370,6 @@ public function getPullRequest($id)
'updated_at' => new \DateTime('1969-12-31T10:00:00+0100'),
'user' => 'weaverryan',
'assignee' => 'cordoval',
'merge_commit' => null, // empty as the pull request is not merged
'merged' => false,
'merged_by' => null,
'head' => [
Expand Down Expand Up @@ -481,7 +471,6 @@ public function getPullRequests($state = null, $page = 1, $perPage = 30)
'updated_at' => new \DateTime('2014-04-14T17:24:12+0100'),
'user' => 'pierredup',
'assignee' => 'cordoval',
'merge_commit' => null, // empty as the pull request is not merged
'merged' => false,
'merged_by' => null,
'head' => [
Expand Down
8 changes: 0 additions & 8 deletions tests/Fixtures/Adapter/TestIssueTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ public function authenticate()
return true;
}

/**
* {@inheritdoc}
*/
public function getTokenGenerationUrl()
{
return;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit fb4c7bf

Please sign in to comment.