Hook::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5
 *
6
 * Copyright (c) 2016-2024 BigBlueButton Inc. and by respective authors (see below).
7
 *
8
 * This program is free software; you can redistribute it and/or modify it under the
9
 * terms of the GNU Lesser General Public License as published by the Free Software
10
 * Foundation; either version 3.0 of the License, or (at your option) any later
11
 * version.
12
 *
13
 * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
14
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License along
18
 * with BigBlueButton; if not, see <https://www.gnu.org/licenses/>.
19
 */
20
21
namespace BigBlueButton\Core;
22
23
/**
24
 * Class Meeting.
25
 */
26
class Hook
27
{
28
    protected \SimpleXMLElement $rawXml;
29
30
    private int $hookId;
31
32
    private string $meetingId;
33
34
    private string $callbackUrl;
35
36
    private bool $permanentHook;
37
38
    private bool $rawData;
39
40
    public function __construct(\SimpleXMLElement $xml)
41
    {
42
        $this->rawXml        = $xml;
43
        $this->hookId        = (int) $xml->hookID->__toString();
44
        $this->callbackUrl   = $xml->callbackURL->__toString();
45
        $this->meetingId     = $xml->meetingID->__toString();
46
        $this->permanentHook = 'true' === $xml->permanentHook->__toString();
47
        $this->rawData       = 'true' === $xml->rawData->__toString();
48
    }
49
50
    public function getHookId(): int
51
    {
52
        return $this->hookId;
53
    }
54
55
    public function getMeetingId(): string
56
    {
57
        return $this->meetingId;
58
    }
59
60
    public function getCallbackUrl(): string
61
    {
62
        return $this->callbackUrl;
63
    }
64
65
    public function isPermanentHook(): ?bool
66
    {
67
        return $this->permanentHook;
68
    }
69
70
    public function hasRawData(): ?bool
71
    {
72
        return $this->rawData;
73
    }
74
}
75