| Conditions | 6 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 1 | public function getComments(string $startDate): array |
|
| 28 | { |
||
| 29 | 1 | $activities = $this->jiraClient->search( |
|
| 30 | 1 | sprintf($this->jiraConfigDto->jiraQuery, $startDate), |
|
| 31 | 1 | 0, |
|
| 32 | 1 | $this->jiraConfigDto->jiraMaxResults |
|
| 33 | ); |
||
| 34 | 1 | $ticketList = array_map( |
|
| 35 | 1 | static fn (Issue $issue) => $issue->key, |
|
| 36 | 1 | $activities->getIssues() |
|
| 37 | ); |
||
| 38 | |||
| 39 | 1 | $jiraActivities = []; |
|
| 40 | 1 | foreach ($ticketList as $issueKey) { |
|
| 41 | 1 | $comments = $this->jiraClient->getComments($issueKey); |
|
| 42 | 1 | foreach ($comments->comments as $comment) { |
|
| 43 | 1 | $passedDate = \DateTime::createFromFormat('Y-m-d H:i', $startDate); |
|
| 44 | 1 | if (($comment->updated >= $passedDate) |
|
| 45 | 1 | && (isset($comment->author->emailAddress) && $comment->author->emailAddress === $this->jiraConfigDto->jiraUser)) { |
|
| 46 | $jiraActivities[$issueKey][] = $comment; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 | 1 | ||
| 51 | return $jiraActivities; |
||
| 52 | } |
||
| 54 |