Completed
Push — develop ( f101a1...f94113 )
by Chris
12s
created

Segment   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 88.24%

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 5
dl 0
loc 91
ccs 30
cts 34
cp 0.8824
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A setMediaSequence() 0 6 1
A getMediaSequence() 0 4 1
A setDiscontinuitySequence() 0 6 1
A getDiscontinuitySequence() 0 4 1
A getUri() 0 4 1
A getDiscontinuityTag() 0 4 1
A isDiscontinuity() 0 4 1
A getExtinfTag() 0 4 1
A getByteRangeTag() 0 4 1
A isEmpty() 0 4 1
A getComponents() 0 9 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 $uri;
20
21
    private $mediaSequence;
22
    private $discontinuitySequence;
23
24 2
    public function __construct($m3u8Version = null)
25
    {
26 2
        $this->extinfTag = new Tag\ExtinfTag($m3u8Version);
27 2
        $this->byteRangeTag = new Tag\ByteRangeTag();
28 2
        $this->discontinuityTag = new Tag\DiscontinuityTag();
29 2
        $this->uri = new Uri();
30 2
    }
31
32 1
    public function setMediaSequence($mediaSequence)
33
    {
34 1
        $this->mediaSequence = $mediaSequence;
35
36 1
        return $this;
37
    }
38
39
    public function getMediaSequence()
40
    {
41
        return $this->mediaSequence;
42
    }
43
44 1
    public function setDiscontinuitySequence($discontinuitySequence)
45
    {
46 1
        $this->discontinuitySequence = $discontinuitySequence;
47
48 1
        return $this;
49
    }
50
51
    public function getDiscontinuitySequence()
52
    {
53
        return $this->discontinuitySequence;
54
    }
55
56 2
    public function getUri()
57
    {
58 2
        return $this->uri;
59
    }
60
61
    /**
62
     * @return Chrisyue\PhpM3u8\Tag\DiscontinuityTag
63
     */
64 1
    public function getDiscontinuityTag()
65
    {
66 1
        return $this->discontinuityTag;
67
    }
68
69 1
    public function isDiscontinuity()
70
    {
71 1
        return $this->discontinuityTag->isDiscontinuity();
72
    }
73
74
    /**
75
     * @return Chrisyue\PhpM3u8\Tag\ExtinfTag
76
     */
77 2
    public function getExtinfTag()
78
    {
79 2
        return $this->extinfTag;
80
    }
81
82
    /**
83
     * @return Chrisyue\PhpM3u8\Tag\ByteRangeTag
84
     */
85 2
    public function getByteRangeTag()
86
    {
87 2
        return $this->byteRangeTag;
88
    }
89
90 1
    public function isEmpty()
91
    {
92 1
        return $this->uri->isEmpty();
93
    }
94
95 2
    protected function getComponents()
96
    {
97
        return array(
98 2
            $this->extinfTag,
99 2
            $this->byteRangeTag,
100 2
            $this->discontinuityTag,
101 2
            $this->uri,
102 2
        );
103
    }
104
}
105