diff --git a/src/Adapter/Adapter.php b/src/Adapter/Adapter.php index e696ce20..2fad6bb6 100644 --- a/src/Adapter/Adapter.php +++ b/src/Adapter/Adapter.php @@ -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. @@ -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": [ @@ -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. * diff --git a/src/Adapter/IssueTracker.php b/src/Adapter/IssueTracker.php index 6616f60c..83595856 100644 --- a/src/Adapter/IssueTracker.php +++ b/src/Adapter/IssueTracker.php @@ -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. * diff --git a/src/Factory/AdapterFactory.php b/src/Factory/AdapterFactory.php index f89ddfe5..4076b844 100644 --- a/src/Factory/AdapterFactory.php +++ b/src/Factory/AdapterFactory.php @@ -26,7 +26,7 @@ class AdapterFactory const SUPPORT_ISSUE_TRACKER = 'supports_issue_tracker'; /** - * @var string[] + * @var array */ private $adapters = []; diff --git a/src/Helper/TemplateHelper.php b/src/Helper/TemplateHelper.php index 07ea6baa..06dfb2d8 100644 --- a/src/Helper/TemplateHelper.php +++ b/src/Helper/TemplateHelper.php @@ -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) { diff --git a/src/ThirdParty/Bitbucket/BitbucketAdapter.php b/src/ThirdParty/Bitbucket/BitbucketAdapter.php index e3efad9f..bfa098cb 100644 --- a/src/ThirdParty/Bitbucket/BitbucketAdapter.php +++ b/src/ThirdParty/Bitbucket/BitbucketAdapter.php @@ -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) { diff --git a/src/ThirdParty/Bitbucket/BitbucketRepoAdapter.php b/src/ThirdParty/Bitbucket/BitbucketRepoAdapter.php index d0ee0ac1..14161fc4 100644 --- a/src/ThirdParty/Bitbucket/BitbucketRepoAdapter.php +++ b/src/ThirdParty/Bitbucket/BitbucketRepoAdapter.php @@ -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(), ]; @@ -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} */ @@ -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' => [ diff --git a/src/ThirdParty/Github/GitHubAdapter.php b/src/ThirdParty/Github/GitHubAdapter.php index cf8c4702..2368a2a6 100644 --- a/src/ThirdParty/Github/GitHubAdapter.php +++ b/src/ThirdParty/Github/GitHubAdapter.php @@ -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} */ @@ -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} */ @@ -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' => [ diff --git a/src/ThirdParty/Gitlab/Adapter/GitLabAdapter.php b/src/ThirdParty/Gitlab/Adapter/GitLabAdapter.php index 6e488f40..e918ad47 100644 --- a/src/ThirdParty/Gitlab/Adapter/GitLabAdapter.php +++ b/src/ThirdParty/Gitlab/Adapter/GitLabAdapter.php @@ -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'); diff --git a/src/ThirdParty/Gitlab/Adapter/GitLabRepoAdapter.php b/src/ThirdParty/Gitlab/Adapter/GitLabRepoAdapter.php index 106198eb..7ac3bf82 100644 --- a/src/ThirdParty/Gitlab/Adapter/GitLabRepoAdapter.php +++ b/src/ThirdParty/Gitlab/Adapter/GitLabRepoAdapter.php @@ -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} */ diff --git a/src/ThirdParty/Gitlab/Model/MergeRequest.php b/src/ThirdParty/Gitlab/Model/MergeRequest.php index 7e83512a..2db619ff 100644 --- a/src/ThirdParty/Gitlab/Model/MergeRequest.php +++ b/src/ThirdParty/Gitlab/Model/MergeRequest.php @@ -44,7 +44,6 @@ public function toArray() 'updated_at' => null, 'user' => null, 'assignee' => null, - 'merge_commit' => null, 'merged' => false, 'merged_by' => null, 'head' => [ diff --git a/tests/Fixtures/Adapter/TestAdapter.php b/tests/Fixtures/Adapter/TestAdapter.php index 84e2441a..dccd33fd 100644 --- a/tests/Fixtures/Adapter/TestAdapter.php +++ b/tests/Fixtures/Adapter/TestAdapter.php @@ -59,14 +59,6 @@ public function authenticate() return true; } - /** - * {@inheritdoc} - */ - public function getTokenGenerationUrl() - { - return; - } - /** * {@inheritdoc} */ @@ -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' => [ @@ -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' => [ @@ -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' => [ diff --git a/tests/Fixtures/Adapter/TestIssueTracker.php b/tests/Fixtures/Adapter/TestIssueTracker.php index 950457ae..0c30c4e0 100644 --- a/tests/Fixtures/Adapter/TestIssueTracker.php +++ b/tests/Fixtures/Adapter/TestIssueTracker.php @@ -32,14 +32,6 @@ public function authenticate() return true; } - /** - * {@inheritdoc} - */ - public function getTokenGenerationUrl() - { - return; - } - /** * {@inheritdoc} */