Code Duplication    Length = 30-34 lines in 5 locations

src/Tag/DiscontinuitySequenceTag.php 1 location

@@ 14-47 (lines=34) @@
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
class DiscontinuitySequenceTag extends AbstractTag
15
{
16
    use SingleValueTagTrait;
17
18
    private $discontinuitySequence;
19
20
    const TAG_IDENTIFIER = '#EXT-X-DISCONTINUITY-SEQUENCE';
21
22
    public function setDiscontinuitySequence($discontinuitySequence)
23
    {
24
        $this->discontinuitySequence = $discontinuitySequence;
25
26
        return $this;
27
    }
28
29
    public function getDiscontinuitySequence()
30
    {
31
        return $this->discontinuitySequence;
32
    }
33
34
    public function dump()
35
    {
36
        if (null === $this->discontinuitySequence) {
37
            return;
38
        }
39
40
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->discontinuitySequence);
41
    }
42
43
    protected function read($line)
44
    {
45
        $this->discontinuitySequence = self::extractValue($line);
46
    }
47
}
48

src/Tag/MediaSequenceTag.php 1 location

@@ 14-47 (lines=34) @@
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
class MediaSequenceTag extends AbstractTag
15
{
16
    use SingleValueTagTrait;
17
18
    private $mediaSequence;
19
20
    const TAG_IDENTIFIER = '#EXT-X-MEDIA-SEQUENCE';
21
22
    public function setMediaSequence($mediaSequence)
23
    {
24
        $this->mediaSequence = $mediaSequence;
25
26
        return $this;
27
    }
28
29
    public function getMediaSequence()
30
    {
31
        return $this->mediaSequence;
32
    }
33
34
    public function dump()
35
    {
36
        if (null === $this->mediaSequence) {
37
            return;
38
        }
39
40
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->mediaSequence);
41
    }
42
43
    protected function read($line)
44
    {
45
        $this->mediaSequence = self::extractValue($line);
46
    }
47
}
48

src/Tag/PlaylistTypeTag.php 1 location

@@ 14-47 (lines=34) @@
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
class PlaylistTypeTag extends AbstractTag
15
{
16
    use SingleValueTagTrait;
17
18
    private $playlistType;
19
20
    const TAG_IDENTIFIER = '#EXT-X-PLAYLIST-TYPE';
21
22
    public function setPlaylistType($playlistType)
23
    {
24
        $this->playlistType = $playlistType;
25
26
        return $this;
27
    }
28
29
    public function getPlaylistType()
30
    {
31
        return $this->playlistType;
32
    }
33
34
    public function dump()
35
    {
36
        if (null === $this->playlistType) {
37
            return;
38
        }
39
40
        return sprintf('%s:%s', self::TAG_IDENTIFIER, $this->playlistType);
41
    }
42
43
    protected function read($line)
44
    {
45
        $this->playlistType = (string) self::extractValue($line);
46
    }
47
}
48

src/Tag/TargetDurationTag.php 1 location

@@ 14-47 (lines=34) @@
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
class TargetDurationTag extends AbstractTag
15
{
16
    use SingleValueTagTrait;
17
18
    private $targetDuration;
19
20
    const TAG_IDENTIFIER = '#EXT-X-TARGETDURATION';
21
22
    public function setTargetDuration($targetDuration)
23
    {
24
        $this->targetDuration = $targetDuration;
25
26
        return $this;
27
    }
28
29
    public function getTargetDuration()
30
    {
31
        return $this->targetDuration;
32
    }
33
34
    public function dump()
35
    {
36
        if (null === $this->targetDuration) {
37
            return;
38
        }
39
40
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->targetDuration);
41
    }
42
43
    protected function read($line)
44
    {
45
        $this->targetDuration = self::extractValue($line);
46
    }
47
}
48

src/Tag/VersionTag.php 1 location

@@ 14-43 (lines=30) @@
11
12
namespace Chrisyue\PhpM3u8\Tag;
13
14
class VersionTag extends AbstractTag
15
{
16
    use SingleValueTagTrait;
17
18
    private $version = 3;
19
20
    const TAG_IDENTIFIER = '#EXT-X-VERSION';
21
22
    public function setVersion($version)
23
    {
24
        $this->version = $version;
25
26
        return $this;
27
    }
28
29
    public function getVersion()
30
    {
31
        return $this->version;
32
    }
33
34
    public function dump()
35
    {
36
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->version);
37
    }
38
39
    protected function read($line)
40
    {
41
        $this->version = (int) self::extractValue($line);
42
    }
43
}
44