Completed
Pull Request — develop (#19)
by Chris
03:20
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;
0 ignored issues
show
Unused Code introduced by
The property $byterangeTag is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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();
0 ignored issues
show
Bug introduced by
The property byteRangeTag does not seem to exist. Did you mean byterangeTag?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
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;
0 ignored issues
show
Bug introduced by
The property byteRangeTag does not seem to exist. Did you mean byterangeTag?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
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,
0 ignored issues
show
Bug introduced by
The property byteRangeTag does not seem to exist. Did you mean byterangeTag?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
100 2
            $this->discontinuityTag,
101 2
            $this->uri,
102 2
        );
103
    }
104
}
105