• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

littleredbutton / bigbluebutton-api-php / 8048458265

26 Feb 2024 11:58AM UTC coverage: 94.541% (-0.3%) from 94.875%
8048458265

Pull #181

github

SamuelWei
Add errors to PutRecordingTextTrackResponse
Pull Request #181: Recording response errors

3 of 6 new or added lines in 4 files covered. (50.0%)

1 existing line in 1 file now uncovered.

762 of 806 relevant lines covered (94.54%)

34.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.54
/src/Responses/BaseResponseAsJson.php
1
<?php
2
/**
3
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
4
 *
5
 * Copyright (c) 2016-2018 BigBlueButton Inc. and by respective authors (see below).
6
 *
7
 * This program is free software; you can redistribute it and/or modify it under the
8
 * terms of the GNU Lesser General Public License as published by the Free Software
9
 * Foundation; either version 3.0 of the License, or (at your option) any later
10
 * version.
11
 *
12
 * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License along
17
 * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
namespace BigBlueButton\Responses;
21

22
/**
23
 * Class BaseResponseAsJson.
24
 */
25
abstract class BaseResponseAsJson
26
{
27
    public const SUCCESS = 'SUCCESS';
28
    public const FAILED = 'FAILED';
29
    public const CHECKSUM_ERROR = 'checksumError';
30

31
    protected $data;
32

33
    /**
34
     * BaseResponseAsJson constructor.
35
     *
36
     * @param string $rawJson
37
     */
38
    public function __construct($rawJson)
39
    {
40
        $this->data = json_decode($rawJson);
5✔
41
    }
42

43
    public function getRawJson(): string
44
    {
45
        return json_encode($this->data);
×
46
    }
47

48
    public function getRawArray(): array
49
    {
50
        return json_decode(json_encode($this->data), true);
×
51
    }
52

53
    public function getMessage(): ?string
54
    {
55
        if ($this->failed()) {
1✔
56
            return $this->data->response->message;
×
57
        }
58

59
        return null;
1✔
60
    }
61

62
    public function getMessageKey(): ?string
63
    {
64
        if ($this->failed()) {
1✔
65
            return $this->data->response->messageKey;
×
66
        }
67

68
        return null;
1✔
69
    }
70

71
    public function getReturnCode(): string
72
    {
73
        return $this->data->response->returncode;
4✔
74
    }
75

76
    public function success(): bool
77
    {
78
        return $this->getReturnCode() === self::SUCCESS;
4✔
79
    }
80

81
    public function failed(): bool
82
    {
83
        return $this->getReturnCode() === self::FAILED;
3✔
84
    }
85

86
    /**
87
     * Check is response is checksum error.
88
     */
89
    public function hasChecksumError(): bool
90
    {
UNCOV
91
        return $this->failed() && $this->getMessageKey() === self::CHECKSUM_ERROR;
×
92
    }
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc