Completed
Push — develop ( a716d3...071802 )
by Chris
9s
created

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