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

MeetingInstances::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 MeetingInstances. The list of one meeting's ended instances.
11
 *
12
 * @see MeetingInstance
13
 */
14
class MeetingInstances
15
{
16
    use JsonDeserializableTrait;
17
18
    /** @var MeetingInstance[] List of ended meeting instances. */
19
    public $meetings;
20
21
    /**
22
     * MeetingInstances constructor.
23
     */
24
    public function __construct()
25
    {
26
        $this->meetings = [];
27
    }
28
29
    /**
30
     * Retrieves a meeting's instances.
31
     *
32
     * @param int $meetingId
33
     *
34
     * @throws Exception
35
     *
36
     * @return MeetingInstances the meeting's instances
37
     */
38
    public static function fromMeetingId($meetingId)
39
    {
40
        return static::fromJson(Client::getInstance()->send('GET', "past_meetings/$meetingId/instances"));
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function itemClass($propertyName)
47
    {
48
        if ('meetings' === $propertyName) {
49
            return MeetingInstance::class;
50
        }
51
        throw new Exception("No such array property $propertyName");
52
    }
53
}
54