/** * (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; }
/** * (non-PHPdoc) * * @see \ShowMeTheIssue\src\ShowMeTheIssue\Repo\RepoInterface::getIssues() * @return ShowMeTheIssue\Entity\Issue[] * @todo inject hydrator * @todo inject IssueService */ public function getIssuesFromRepo($account = null, $repo = null, array $filter = []) { 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 = $this->client->api('issue')->all($account, $repo, $filter); $issueList = new IssueCollection(); $issueHydrator = new IssueHydrator(); $i = 0; foreach ($issues as $issue) { $issueObject = new Issue(); $issueHydrator->hydrate($issue, $issueObject); $issueList->append($issueObject); } return $issueList; }