Code Duplication    Length = 19-19 lines in 2 locations

src/M3u8/Transformer/TagInfo.php 1 location

@@ 7-25 (lines=19) @@
4
5
class TagInfo implements TransformerInterface
6
{
7
    public function transform($line)
8
    {
9
        $line = trim($line);
10
        if (empty($line)) {
11
            return;
12
        }
13
14
        if ('#' !== $line[0]) {
15
            return ['value' => $line];
16
        }
17
18
        if (strlen($line) < 2) {
19
            return;
20
        }
21
22
        list($tag, $value) = array_pad(explode(':', $line, 2), 2, '');
23
24
        return compact('tag', 'value');
25
    }
26
27
    public function reverse($lineInfo)
28
    {

src/Stream/AbstractStream.php 1 location

@@ 40-58 (lines=19) @@
37
38
    abstract protected function putLine($line);
39
40
    private function getLineInfo($line)
41
    {
42
        $line = trim($line);
43
        if (empty($line)) {
44
            return;
45
        }
46
47
        if ('#' !== $line[0]) {
48
            return ['value' => $line];
49
        }
50
51
        if (strlen($line) < 2) {
52
            return;
53
        }
54
55
        list($tag, $value) = array_pad(explode(':', $line, 2), 2, '');
56
57
        return compact('tag', 'value');
58
    }
59
}
60