Completed
Pull Request — develop (#30)
by
unknown
02:35
created

Segment::getProgramDateTimeTag()   A

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
    private $byteRangeTag;
18
    private $discontinuityTag;
19
    private $programDateTimeTag;
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->programDateTimeTag = new Tag\ProgramDateTimeTag();
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\KeyTags
101
     */
102 2
    public function getKeyTags()
103
    {
104 2
        return $this->keyTags;
105
    }
106
107
    /**
108
     * @return Tag\ProgramDateTimeTag
109
     */
110
    public function getProgramDateTimeTag()
111
    {
112
        return $this->programDateTimeTag;
113
    }
114
115
    /**
116
     * @param Tag\ProgramDateTimeTag $programDateTimeTag
117
     */
118
    public function setProgramDateTimeTag(Tag\ProgramDateTimeTag $programDateTimeTag)
119
    {
120
        $this->programDateTimeTag = $programDateTimeTag;
121
    }
122
123
    /**
124
     * @return bool
125
     */
126 1
    public function isEmpty()
127
    {
128 1
        return $this->uri->isEmpty();
129
    }
130
131 2
    protected function getComponents()
132
    {
133
        return [
134 2
            $this->keyTags,
135 2
            $this->extinfTag,
136 2
            $this->byteRangeTag,
137 2
            $this->discontinuityTag,
138 2
            $this->programDateTimeTag,
139 2
            $this->uri,
140 2
        ];
141
    }
142
}
143