Passed
Pull Request — master (#189)
by Ghazi
10:24
created

Format   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
eloc 24
c 1
b 0
f 0
dl 0
loc 67
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getImages() 0 10 3
A getLength() 0 3 1
A getUrl() 0 3 1
A getType() 0 3 1
A getSize() 0 3 1
A getProcessingTime() 0 3 1
1
<?php
2
3
/*
4
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5
 *
6
 * Copyright (c) 2016-2022 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
21
namespace BigBlueButton\Core;
22
23
class Format
24
{
25
    /**
26
     * @var \SimpleXMLElement
27
     */
28
    protected $rawXml;
29
30
    private $type;
31
    private $url;
32
    private $processingTime;
33
    private $length;
34
    private $size;
35
    private $images;
36
37
    /**
38
     * Record constructor.
39
     *
40
     * @param $xml \SimpleXMLElement
41
     */
42
    public function __construct($xml)
43
    {
44
        $this->rawXml         = $xml;
45
        $this->type           = $xml->type->__toString();
46
        $this->url            = $xml->url->__toString();
47
        $this->processingTime = (int) $xml->processingTime->__toString();
48
        $this->length         = (int) $xml->length->__toString();
49
        $this->size           = (int) $xml->size->__toString();
50
    }
51
52
    /**
53
     * @return Image[]
54
     */
55
    public function getImages()
56
    {
57
        if (null === $this->images) {
58
            $this->images = [];
59
            foreach ($this->rawXml->preview->images->image as $imageXml) {
60
                $this->images[] = new Image($imageXml);
61
            }
62
        }
63
64
        return $this->images;
65
    }
66
67
    public function getType(): string
68
    {
69
        return $this->type;
70
    }
71
72
    public function getUrl(): string
73
    {
74
        return $this->url;
75
    }
76
77
    public function getProcessingTime(): int
78
    {
79
        return $this->processingTime;
80
    }
81
82
    public function getLength(): int
83
    {
84
        return $this->length;
85
    }
86
87
    public function getSize(): int
88
    {
89
        return $this->size;
90
    }
91
}
92