Completed
Pull Request — develop (#29)
by
unknown
08:36
created

Segment::getDiscontinuityTag()   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 $streamTags;
20
    private $keyTags;
21
    private $uri;
22
23
    private $mediaSequence;
24
    private $discontinuitySequence;
25
26 2
    public function __construct($m3u8Version = null)
27
    {
28 2
        $this->extinfTag = new Tag\ExtinfTag($m3u8Version);
29 2
        $this->byteRangeTag = new Tag\ByteRangeTag();
30 2
        $this->discontinuityTag = new Tag\DiscontinuityTag();
31 2
        $this->streamTags = new StreamTags();
32 2
        $this->keyTags = new KeyTags();
33 2
        $this->uri = new Uri();
34 2
    }
35
36 1
    public function setMediaSequence($mediaSequence)
37
    {
38 1
        $this->mediaSequence = $mediaSequence;
39
40 1
        return $this;
41
    }
42
43
    public function getMediaSequence()
44
    {
45
        return $this->mediaSequence;
46
    }
47
48 1
    public function setDiscontinuitySequence($discontinuitySequence)
49
    {
50 1
        $this->discontinuitySequence = $discontinuitySequence;
51
52 1
        return $this;
53
    }
54
55
    public function getDiscontinuitySequence()
56
    {
57
        return $this->discontinuitySequence;
58
    }
59
60 2
    public function getUri()
61
    {
62 2
        return $this->uri;
63
    }
64
65
    /**
66
     * @return Chrisyue\PhpM3u8\Tag\DiscontinuityTag
67
     */
68 1
    public function getDiscontinuityTag()
69
    {
70 1
        return $this->discontinuityTag;
71
    }
72
73 1
    public function isDiscontinuity()
74
    {
75 1
        return $this->discontinuityTag->isDiscontinuity();
76
    }
77
78
    /**
79
     * @return Chrisyue\PhpM3u8\Tag\ExtinfTag
80
     */
81 2
    public function getExtinfTag()
82
    {
83 2
        return $this->extinfTag;
84
    }
85
86 1
    public function getDuration()
87
    {
88 1
        return $this->extinfTag->getDuration();
89
    }
90
91
    /**
92
     * @return Chrisyue\PhpM3u8\Tag\ByteRangeTag
93
     */
94 2
    public function getByteRangeTag()
95
    {
96 2
        return $this->byteRangeTag;
97
    }
98
99
    /**
100
     * @return Chrisyue\PhpM3u8\StreamTags
101
     */
102
    public function getStreamTags()
103
    {
104
        return $this->streamTags;
105
    }
106
107
    /**
108
     * @return Chrisyue\PhpM3u8\KeyTags
109
     */
110 2
    public function getKeyTags()
111
    {
112 2
        return $this->keyTags;
113
    }
114
115
    /**
116
     * @return bool
117
     */
118 1
    public function isEmpty()
119
    {
120 1
        return $this->uri->isEmpty();
121
    }
122
123 2
    protected function getComponents()
124
    {
125
        return [
126 2
            $this->streamTags,
127 2
            $this->keyTags,
128 2
            $this->extinfTag,
129 2
            $this->byteRangeTag,
130 2
            $this->discontinuityTag,
131 2
            $this->uri,
132 2
        ];
133
    }
134
}
135