Passed
Push — master ( c22b6a...5f79f5 )
by Julito
11:21
created

RegistrantRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A meetingsComingSoonRegistrationsForUser() 0 8 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\PluginBundle\Zoom;
6
7
use Chamilo\UserBundle\Entity\User;
8
use DateInterval;
9
use DateTime;
10
use Doctrine\ORM\EntityRepository;
11
12
/**
13
 * Class RegistrantEntityRepository.
14
 */
15
class RegistrantRepository extends EntityRepository
16
{
17
    /**
18
     * Returns the upcoming meeting registrations for the given user.
19
     *
20
     * @param User $user
21
     *
22
     * @return array|Registrant[]
23
     */
24
    public function meetingsComingSoonRegistrationsForUser($user)
25
    {
26
        $start = new DateTime();
27
        $end = new DateTime();
28
        $end->add(new DateInterval('P7D'));
29
        $meetings = $this->getEntityManager()->getRepository(Meeting::class)->periodMeetings($start, $end);
30
31
        return $this->findBy(['meeting' => $meetings, 'user' => $user]);
32
    }
33
}
34