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

ParticipantList::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 ParticipantList
11
 * List of past meeting instance participants.
12
 *
13
 * @see ParticipantListItem;
14
 */
15
class ParticipantList
16
{
17
    use PaginationToken;
18
19
    /** @var ParticipantListItem[] */
20
    public $participants;
21
22
    /**
23
     * ParticipantList constructor.
24
     */
25
    public function __construct()
26
    {
27
        $this->participants = [];
28
    }
29
30
    /**
31
     * Retrieves a meeting instance's participants.
32
     *
33
     * @param string $instanceUUID
34
     *
35
     * @throws Exception
36
     *
37
     * @return ParticipantListItem[] participants
38
     */
39
    public static function loadInstanceParticipants($instanceUUID)
40
    {
41
        return static::loadItems(
42
            'participants',
43
            'past_meetings/'.htmlentities($instanceUUID).'/participants'
44
        );
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function itemClass($propertyName)
51
    {
52
        if ('participants' === $propertyName) {
53
            return ParticipantListItem::class;
54
        }
55
        throw new Exception("No such array property $propertyName");
56
    }
57
}
58