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

MeetingRegistrantList::itemClass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
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