/** * (non-PHPdoc) * @see \ShowMeTheIssue\src\ShowMeTheIssue\Repo\RepoInterface::getIssues() * @return ShowMeTheIssue\Entity\Issue[] * @todo accept a configuration object. */ public function getIssuesFromRepo($account = null, $repo = null, array $filter = null) { if ($repo == null) { throw new \InvalidArgumentException('No repo parameter specified.'); } if ($account == null) { throw new \InvalidArgumentException('No account parameter specified for this repo: ' . $repo); } $issues = json_decode($this->issueConnector->all($account, $repo, $filter)->getContent(), true); $issueList = new IssueCollection(); $issueHydrator = new IssueHydrator(); foreach ($issues['issues'] as $issue) { $issueObject = new Issue(); $issueHydrator->hydrate($issue, $issueObject); $issueList->append($issueObject); } return $issueList; }
/** * Get the number of issues assigned to a user * @param string $user the username of the user (login) * @param string $owner owner of the repository * @param string $repo name of the repository * @param string $state state of the pullRequest (OPEN,MERGED,DECLINED) * @return Number of issues */ public function getUserIssues($user, $owner, $repo, $state) { $issues = []; $start = 0; $done = false; $issue = new Issues(); while (!$done) { $response = $issue->all($owner, $repo, ['status' => $state, 'repsonsible' => $user, 'start' => $start, 'limit' => 50]); $res = json_decode($response->getContent(), true); $issues = array_merge($issues, $res['issues']); if (count($res['issues']) < 50) { $done = true; } $start = $start + 50; } return $issues; }