本文整理汇总了PHP中Github\Client::issue方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::issue方法的具体用法?PHP Client::issue怎么用?PHP Client::issue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Github\Client
的用法示例。
在下文中一共展示了Client::issue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createIssue
/**
* @param $ticketId
* @param $repository
* @param $assignee
* @return bool
* @throws \Zendesk\API\MissingParametersException
* @throws \Zendesk\API\ResponseException
* @internal param $ticket
*/
public function createIssue($ticketId, $repository, $assignee)
{
$this->logger->debug(sprintf('entering issue creation for ticket #%s in repo %s', $ticketId, $repository));
if ($this->isKnownTicket($ticketId)) {
throw new \InvalidArgumentException('this ticket is already known, cant create twice');
}
try {
$ticket = $this->zClient->ticket($ticketId)->find();
} catch (\Exception $e) {
$this->logger->error($this->zClient->getDebug()->lastResponseHeaders);
return false;
}
if (!is_object($ticket->ticket)) {
throw new \InvalidArgumentException('unable to find zendesk ticket with id ' . $ticketId);
}
try {
$issueDatas = $this->formatIssueDatas($ticket->ticket, $assignee);
$username = isset($this->config['github_organization']) ? $this->config['github_organization'] : $this->config['github_username'];
$issue = $this->gClient->issue()->create($username, $repository, $issueDatas);
if (isset($issue['number'])) {
$this->updateTicketAfterIssueCreation($ticketId, $issue, $repository);
$this->persistCreatedTicket($ticketId, $issue['number'], $repository);
return true;
} else {
$this->logger->error('unable to find issue number from github payload');
throw new \Exception('unable to find created issue Id');
}
} catch (\Exception $e) {
$this->logger->error($e->getMessage());
return false;
}
}
示例2: getIssues
/**
* {@inheritdoc}
*/
public function getIssues(array $criteria = ['state' => 'open'])
{
list($username, $repo) = explode('/', $this->getName());
$pager = new ResultPager($this->client);
$issues = $pager->fetchAll($this->client->issue(), 'all', [$username, $repo, $criteria]);
$newIssues = [];
foreach ($issues as $issue) {
$newIssues[] = new GithubIssue($issue);
}
return $newIssues;
}
示例3: it_returns_Issue_objects_on_getIssues
public function it_returns_Issue_objects_on_getIssues(Client $client, Issue $api, HttpClient $http, Response $response)
{
$client->issue()->willReturn($api);
$client->getHttpClient()->willReturn($http);
$api->getPerPage()->willReturn(5);
$api->setPerPage(Argument::any())->willReturn();
$http->getLastResponse()->willReturn($response);
$response->getHeader('Link')->willReturn(null);
$api->all('foo', 'bar', ['state' => 'open'])->willReturn([['number' => 1], ['number' => 5]]);
$result = $this->getIssues();
$result->shouldBeArray();
$result->shouldHaveCount(2);
$result[0]->shouldHaveType('Rs\\Issues\\Github\\GithubIssue');
$result[0]->getId()->shouldBe(1);
$result[1]->shouldHaveType('Rs\\Issues\\Github\\GithubIssue');
$result[1]->getId()->shouldBe(5);
}
示例4: deleteMilestone
public function deleteMilestone($repository, $number)
{
$this->assertAuthenticated();
$array = explode('/', $repository, 2);
$this->github->issue()->milestones()->remove($array[0], $array[1], $number);
}