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

MeetingInstances   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 itemClass() 0 6 2
A fromMeetingId() 0 3 1
A __construct() 0 3 1
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