HooksCreateResponse   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hasRawData() 0 7 2
A isPermanentHook() 0 7 2
A getHookId() 0 7 2
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\Responses;
22
23
/**
24
 * Class GetRecordingsResponse.
25
 */
26
class HooksCreateResponse extends BaseResponse
27
{
28
    /**
29
     * According to documentation the hookId that needs to be used in the "destroy" command musst be of type number.
30
     * That is why the return here must be a number (= integer) too.
31
     *
32
     * But in the same time this property could be not part of the API-response in case the response failed. So it has
33
     * to return NULL as well.
34
     *
35
     * @see https://docs.bigbluebutton.org/development/webhooks/#hooksdestroy
36
     */
37
    public function getHookId(): ?int
38
    {
39
        if (!$this->rawXml->hookID) {
40
            return null;
41
        }
42
43
        return (int) $this->rawXml->hookID->__toString();
44
    }
45
46
    public function isPermanentHook(): ?bool
47
    {
48
        if (!$this->rawXml->permanentHook) {
49
            return null;
50
        }
51
52
        return 'true' === $this->rawXml->permanentHook->__toString();
53
    }
54
55
    public function hasRawData(): ?bool
56
    {
57
        if (!$this->rawXml->rawData) {
58
            return null;
59
        }
60
61
        return 'true' === $this->rawXml->rawData->__toString();
62
    }
63
}
64