Format::getProcessingTime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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
class Format
24
{
25
    protected \SimpleXMLElement $rawXml;
26
    private string $type;
27
    private string $url;
28
    private int $processingTime;
29
    private int $length;
30
    private int $size;
31
32
    public function __construct(\SimpleXMLElement $xml)
33
    {
34
        $this->rawXml         = $xml;
35
        $this->type           = $xml->type->__toString();
36
        $this->url            = $xml->url->__toString();
37
        $this->processingTime = (int) $xml->processingTime->__toString();
38
        $this->length         = (int) $xml->length->__toString();
39
        $this->size           = (int) $xml->size->__toString();
40
    }
41
42
    /**
43
     * @return Image[]
44
     */
45
    public function getImages(): array
46
    {
47
        $images = [];
48
49
        foreach ($this->rawXml->preview->images->image as $imageXml) {
50
            if ($imageXml) {
51
                $images[] = new Image($imageXml);
52
            }
53
        }
54
55
        return $images;
56
    }
57
58
    public function getType(): string
59
    {
60
        return $this->type;
61
    }
62
63
    public function getUrl(): string
64
    {
65
        return $this->url;
66
    }
67
68
    public function getProcessingTime(): int
69
    {
70
        return $this->processingTime;
71
    }
72
73
    public function getLength(): int
74
    {
75
        return $this->length;
76
    }
77
78
    public function getSize(): int
79
    {
80
        return $this->size;
81
    }
82
}
83