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

MeetingRegistrantList   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 38
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A loadMeetingRegistrants() 0 3 1
A itemClass() 0 6 2
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\PluginBundle\Zoom\API;
6
7
use Exception;
8
9
/**
10
 * Class MeetingRegistrantList. List of meeting registrants.
11
 *
12
 * @see MeetingRegistrantListItem
13
 */
14
class MeetingRegistrantList
15
{
16
    use Pagination;
17
18
    /** @var MeetingRegistrantListItem[] */
19
    public $registrants;
20
21
    /**
22
     * MeetingRegistrantList constructor.
23
     */
24
    public function __construct()
25
    {
26
        $this->registrants = [];
27
    }
28
29
    /**
30
     * Retrieves all registrant for a meeting.
31
     *
32
     * @param int $meetingId
33
     *
34
     * @throws Exception
35
     *
36
     * @return MeetingRegistrantListItem[] all registrants of the meeting
37
     */
38
    public static function loadMeetingRegistrants($meetingId)
39
    {
40
        return static::loadItems('registrants', "meetings/$meetingId/registrants");
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function itemClass($propertyName)
47
    {
48
        if ('registrants' === $propertyName) {
49
            return MeetingRegistrantListItem::class;
50
        }
51
        throw new Exception("no such array property $propertyName");
52
    }
53
}
54