Completed
Push — develop ( bd286b...3e7014 )
by Chris
01:03 queued 59s
created

Segment::getKeyTags()   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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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;
13
14
class Segment extends AbstractContainer
15
{
16
    private $extinfTag;
17
    private $byteRangeTag;
18
    private $discontinuityTag;
19
    private $keyTags;
20
    private $uri;
21
22
    private $mediaSequence;
23
    private $discontinuitySequence;
24
25 2
    public function __construct($m3u8Version = null)
26
    {
27 2
        $this->extinfTag = new Tag\ExtinfTag($m3u8Version);
28 2
        $this->byteRangeTag = new Tag\ByteRangeTag();
29 2
        $this->discontinuityTag = new Tag\DiscontinuityTag();
30 2
        $this->keyTags = new KeyTags();
31 2
        $this->uri = new Uri();
32 2
    }
33
34 1
    public function setMediaSequence($mediaSequence)
35
    {
36 1
        $this->mediaSequence = $mediaSequence;
37
38 1
        return $this;
39
    }
40
41
    public function getMediaSequence()
42
    {
43
        return $this->mediaSequence;
44
    }
45
46 1
    public function setDiscontinuitySequence($discontinuitySequence)
47
    {
48 1
        $this->discontinuitySequence = $discontinuitySequence;
49
50 1
        return $this;
51
    }
52
53
    public function getDiscontinuitySequence()
54
    {
55
        return $this->discontinuitySequence;
56
    }
57
58 2
    public function getUri()
59
    {
60 2
        return $this->uri;
61
    }
62
63
    /**
64
     * @return Chrisyue\PhpM3u8\Tag\DiscontinuityTag
65
     */
66 1
    public function getDiscontinuityTag()
67
    {
68 1
        return $this->discontinuityTag;
69
    }
70
71 1
    public function isDiscontinuity()
72
    {
73 1
        return $this->discontinuityTag->isDiscontinuity();
74
    }
75
76
    /**
77
     * @return Chrisyue\PhpM3u8\Tag\ExtinfTag
78
     */
79 2
    public function getExtinfTag()
80
    {
81 2
        return $this->extinfTag;
82
    }
83
84 1
    public function getDuration()
85
    {
86 1
        return $this->extinfTag->getDuration();
87
    }
88
89
    /**
90
     * @return Chrisyue\PhpM3u8\Tag\ByteRangeTag
91
     */
92 2
    public function getByteRangeTag()
93
    {
94 2
        return $this->byteRangeTag;
95
    }
96
97
    /**
98
     * @return Chrisyue\PhpM3u8\KeyTags
99
     */
100 2
    public function getKeyTags()
101
    {
102 2
        return $this->keyTags;
103
    }
104
105
    /**
106
     * @return bool
107
     */
108 1
    public function isEmpty()
109
    {
110 1
        return $this->uri->isEmpty();
111
    }
112
113 2
    protected function getComponents()
114
    {
115
        return [
116 2
            $this->keyTags,
117 2
            $this->extinfTag,
118 2
            $this->byteRangeTag,
119 2
            $this->discontinuityTag,
120 2
            $this->uri,
121 2
        ];
122
    }
123
}
124