| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function load(Player $player): bool |
||
| 27 | { |
||
| 28 | $qb = $this->em->createQueryBuilder() |
||
| 29 | ->from('VideoGamesRecords\CoreBundle\Entity\ProofRequest', 'request') |
||
| 30 | ->select('COUNT(request)') |
||
| 31 | ->where('request.playerRequesting = :player') |
||
| 32 | ->setParameter('player', $player) |
||
| 33 | ->andWhere('request.createdAt LIKE :now') |
||
| 34 | ->setParameter('now', date('Y-m-d') . '%'); |
||
| 35 | |||
| 36 | $nb = $qb->getQuery()->getSingleScalarResult(); |
||
| 37 | |||
| 38 | if ($nb >= self::MAX_PROOF_REQUEST_DAY) { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | return true; |
||
| 42 | } |
||
| 44 |