Segment::getMediaSequence()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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