| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 0 | ||
| 1 | <?php |
||
| 52 | 1 | public function getCurrentProjectPoll(Project $project): ?Poll |
|
| 53 | { |
||
| 54 | 1 | $results = $this->em->getRepository(Poll::class)->findBy([ |
|
| 55 | 1 | 'project' => $project |
|
| 56 | ], [ |
||
| 57 | 1 | 'createdAt' => 'DESC' |
|
| 58 | 1 | ], 1); |
|
| 59 | 1 | if (count($results) === 0 || $results[0]->getEndedAt() < new \DateTime()) { |
|
| 60 | 1 | return null; |
|
| 61 | } |
||
| 62 | return $results[0]; |
||
| 63 | } |
||
| 64 | } |