| @@ 11-30 (lines=20) @@ | ||
| 8 | ||
| 9 | trait GithubIssueConvertTrait |
|
| 10 | { |
|
| 11 | protected function convertIssue($data) |
|
| 12 | { |
|
| 13 | return new GithubIssueSource( |
|
| 14 | new GithubIssueId($data['id']), |
|
| 15 | $this->githubRepo, |
|
| 16 | $data['number'], |
|
| 17 | GithubIssueStateFactory::create($data['state']), |
|
| 18 | $data['title'], |
|
| 19 | $data['body'], |
|
| 20 | $this->getUser($data['user']), |
|
| 21 | $this->getUserIfExists($data['assignee']), |
|
| 22 | $this->getMilestoneIfExists($data['milestone']), |
|
| 23 | $data['comments'], |
|
| 24 | ||
| 25 | new DateTime($data['created_at']), |
|
| 26 | new DateTime($data['updated_at']), |
|
| 27 | $this->getDateIfExists($data['closed_at']) |
|
| 28 | ||
| 29 | ); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 11-31 (lines=21) @@ | ||
| 8 | ||
| 9 | trait GithubMilestoneConvertTrait |
|
| 10 | { |
|
| 11 | protected function convertMilestone($data) |
|
| 12 | { |
|
| 13 | $milestone = new GithubMilestoneSource( |
|
| 14 | new GithubMilestoneId($data['id']), |
|
| 15 | $this->githubRepo, |
|
| 16 | $data['number'], |
|
| 17 | GithubMilestoneStateFactory::create($data['state']), |
|
| 18 | $data['title'], |
|
| 19 | $data['description'], |
|
| 20 | $this->getUser($data['creator']), |
|
| 21 | $data['open_issues'], |
|
| 22 | $data['closed_issues'], |
|
| 23 | $this->getDateIfExists($data['due_on']), |
|
| 24 | new DateTime($data['created_at']), |
|
| 25 | new DateTime($data['updated_at']), |
|
| 26 | $this->getDateIfExists($data['closed_at']) |
|
| 27 | ||
| 28 | ); |
|
| 29 | ||
| 30 | return $milestone; |
|
| 31 | } |
|
| 32 | ||
| 33 | protected function getMilestoneIfExists($data) |
|
| 34 | { |
|