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

DiscontinuitySequenceTag   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setDiscontinuitySequence() 0 6 1
A getDiscontinuitySequence() 0 4 1
A dump() 0 4 1
A read() 0 5 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\Tag;
13
14
class DiscontinuitySequenceTag extends AbstractSegmentTag
15
{
16
    private $discontinuitySequence = 0;
17
18
    const TAG_IDENTIFIER = '#EXT-X-DISCONTINUITY-SEQUENCE';
19
20 1
    public function setDiscontinuitySequence($discontinuitySequence)
21
    {
22 1
        $this->discontinuitySequence = $discontinuitySequence;
23
24 1
        return $this;
25
    }
26
27 1
    public function getDiscontinuitySequence()
28
    {
29 1
        return $this->discontinuitySequence;
30
    }
31
32 1
    public function dump()
33
    {
34 1
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->discontinuitySequence);
35
    }
36
37 1
    protected function read($line)
38
    {
39 1
        preg_match('/^#EXT-X-DISCONTINUITY-SEQUENCE:(\d+)/', $line, $matches);
40 1
        $this->discontinuitySequence = (int) $matches[1];
41 1
    }
42
}
43