Completed
Pull Request — develop (#10)
by
unknown
03:46
created

MediaSegment::getByteRange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the PhpM3u8 package.
5
 *
6
 * (c) Chrisyue <http://chrisyue.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Chrisyue\PhpM3u8\M3u8;
13
14
class MediaSegment
15
{
16
    protected $uri;
17
    protected $duration;
18
    protected $sequence;
19
    protected $isDiscontinuity;
20
    protected $title;
21
    protected $byterange;
22
23 4
    public function __construct($uri, $duration, $sequence, $isDiscontinuity = false, $title = null, $byteRangeLength = null, $byteRangeOffset = null)
24
    {
25 4
        $this->uri = $uri;
26 4
        $this->duration = $duration;
27 4
        $this->sequence = $sequence;
28 4
        $this->isDiscontinuity = $isDiscontinuity;
29 4
        $this->title = $title;
30 4
        $this->byterange = \SplFixedArray::fromArray(
31
            array(
32 4
                $byteRangeLength,
33 4
                is_null($byteRangeLength) ? null : $byteRangeOffset,
34 4
            ),
35
            false
36 4
        );
37 4
    }
38
39 2
    public function getUri()
40
    {
41 2
        return $this->uri;
42
    }
43
44 2
    public function getDuration()
45
    {
46 2
        return $this->duration;
47
    }
48
49 2
    public function getSequence()
50
    {
51 2
        return $this->sequence;
52
    }
53
54 2
    public function isDiscontinuity()
55
    {
56 2
        return $this->isDiscontinuity;
57
    }
58
59 2
    public function getTitle()
60
    {
61 2
        return $this->title;
62
    }
63
64 2
    public function getByteRange()
65
    {
66 2
        return $this->byterange;
67
    }
68
}
69