Completed
Push — master ( 90d5d6...f37dd9 )
by Ghazi
01:47
created

Hook   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 87
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getHookId() 0 4 1
A getMeetingId() 0 4 1
A getCallbackUrl() 0 4 1
A isPermanentHook() 0 4 1
A hasRawData() 0 4 1
1
<?php
2
3
/**
4
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5
 *
6
 * Copyright (c) 2016-2018 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
namespace BigBlueButton\Core;
21
22
/**
23
 * Class Meeting
24
 * @package BigBlueButton\Core
25
 */
26
class Hook
27
{
28
29
    /**
30
     * @var \SimpleXMLElement
31
     */
32
    protected $rawXml;
33
34
    /**
35
     * @var string
36
     */
37
    private $hookId;
38
39
    /**
40
     * @var string
41
     */
42
    private $meetingId;
43
44
    /**
45
     * @var string
46
     */
47
    private $callbackUrl;
48
49
    /**
50
     * @var bool
51
     */
52
    private $permanentHook;
53
54
    /**
55
     * @var bool
56
     */
57
    private $rawData;
58
59
    /**
60
     * Meeting constructor.
61
     * @param $xml \SimpleXMLElement
62
     */
63
    public function __construct($xml)
64
    {
65
        $this->rawXml        = $xml;
66
        $this->hookId        = (int) $xml->hookID->__toString();
0 ignored issues
show
Documentation Bug introduced by
The property $hookId was declared of type string, but (int) $xml->hookID->__toString() is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
67
        $this->callbackUrl   = $xml->callbackURL->__toString();
68
        $this->meetingId     = $xml->meetingID->__toString();
69
        $this->permanentHook = $xml->permanentHook->__toString() === 'true';
70
        $this->rawData       = $xml->rawData->__toString() === 'true';
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 bool
99
     */
100
    public function isPermanentHook()
101
    {
102
        return $this->permanentHook;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108
    public function hasRawData()
109
    {
110
        return $this->rawData;
111
    }
112
}
113