Passed
Pull Request — master (#189)
by Ghazi
10:24
created

Hook   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 18
c 1
b 0
f 0
dl 0
loc 85
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getMeetingId() 0 3 1
A isPermanentHook() 0 3 1
A getHookId() 0 3 1
A getCallbackUrl() 0 3 1
A hasRawData() 0 3 1
A __construct() 0 8 1
1
<?php
2
3
/*
4
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5
 *
6
 * Copyright (c) 2016-2022 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 <http://www.gnu.org/licenses/>.
19
 */
20
21
namespace BigBlueButton\Core;
22
23
/**
24
 * Class Meeting.
25
 */
26
class Hook
27
{
28
    /**
29
     * @var \SimpleXMLElement
30
     */
31
    protected $rawXml;
32
33
    /**
34
     * @var string
35
     */
36
    private $hookId;
37
38
    /**
39
     * @var string
40
     */
41
    private $meetingId;
42
43
    /**
44
     * @var string
45
     */
46
    private $callbackUrl;
47
48
    /**
49
     * @var bool
50
     */
51
    private $permanentHook;
52
53
    /**
54
     * @var bool
55
     */
56
    private $rawData;
57
58
    /**
59
     * Meeting constructor.
60
     *
61
     * @param $xml \SimpleXMLElement
62
     */
63
    public function __construct($xml)
64
    {
65
        $this->rawXml        = $xml;
66
        $this->hookId        = (int) $xml->hookID->__toString();
67
        $this->callbackUrl   = $xml->callbackURL->__toString();
68
        $this->meetingId     = $xml->meetingID->__toString();
69
        $this->permanentHook = 'true' === $xml->permanentHook->__toString();
70
        $this->rawData       = 'true' === $xml->rawData->__toString();
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getHookId()
77
    {
78
        return $this->hookId;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getMeetingId()
85
    {
86
        return $this->meetingId;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getCallbackUrl()
93
    {
94
        return $this->callbackUrl;
95
    }
96
97
    /**
98
     * @return null|bool
99
     */
100
    public function isPermanentHook()
101
    {
102
        return $this->permanentHook;
103
    }
104
105
    /**
106
     * @return null|bool
107
     */
108
    public function hasRawData()
109
    {
110
        return $this->rawData;
111
    }
112
}
113