/**
  * {@inheritdoc}
  */
 public function updatePullRequest($id, array $parameters)
 {
     $issue = $this->client->api('merge_requests')->show($this->getCurrentProject()->id, $id);
     $issue = Issue::fromArray($this->client, $this->getCurrentProject(), $issue);
     if (isset($parameters['assignee'])) {
         $assignee = $this->client->api('users')->search($parameters['assignee']);
         if (count($assignee) === 0) {
             throw new \InvalidArgumentException(sprintf('Could not find user %s', $parameters['assignee']));
         }
         $issue->update(['assignee_id' => current($assignee)['id']]);
     }
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function getIssues(array $parameters = [], $limit = 30)
 {
     $issues = $this->client->api('issues')->all($this->getCurrentProject()->id);
     if (isset($parameters['state'])) {
         $parameters['state'] = $parameters['state'] === 'open' ? 'opened' : 'closed';
         $issues = array_filter($issues, function ($issue) use($parameters) {
             return $issue['state'] === $parameters['state'];
         });
     }
     if (isset($parameters['creator'])) {
         $issues = array_filter($issues, function ($issue) use($parameters) {
             return $issue['user']['login'] === $parameters['creator'];
         });
     }
     if (isset($parameters['assignee'])) {
         $issues = array_filter($issues, function ($issue) use($parameters) {
             return $issue['assignee']['login'] === $parameters['assignee'];
         });
     }
     return array_map(function ($issue) {
         if (isset($issue['milestone']['title'])) {
             $issue['milestone'] = $issue['milestone']['title'];
         }
         return Issue::fromArray($this->client, $this->getCurrentProject(), $issue)->toArray();
     }, $issues);
 }
 /**
  * {@inheritdoc}
  */
 public function getComments($id)
 {
     $issue = Issue::fromArray($this->client, $this->getCurrentProject(), $this->client->api('issues')->show($this->getCurrentProject()->id, $id));
     return $issue->showComments();
 }