Image::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
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 Record.
25
 */
26
class Image
27
{
28
    private string $alt;
29
    private int $height;
30
    private int $width;
31
    private string $url;
32
33
    public function __construct(\SimpleXMLElement $xml)
34
    {
35
        $this->alt    = $xml['alt'] ? $xml['alt']->__toString() : '';
36
        $this->height = (int) $xml['height'];
37
        $this->width  = (int) $xml['width'];
38
        $this->url    = $xml->__toString();
39
    }
40
41
    public function getAlt(): string
42
    {
43
        return $this->alt;
44
    }
45
46
    public function getHeight(): int
47
    {
48
        return $this->height;
49
    }
50
51
    public function getWidth(): int
52
    {
53
        return $this->width;
54
    }
55
56
    public function getUrl(): string
57
    {
58
        return $this->url;
59
    }
60
}
61