Completed
Pull Request — develop (#27)
by Chris
13:34
created

StreamInf::dump()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\M3u8\Core;
4
5
use Chrisyue\PhpM3u8\M3u8\Lines\LinesInterface;
6
7
/**
8
 * @Annotation
9
 * @Target("PROPERTY")
10
 */
11
class StreamInf implements ChildCoreInterface
12
{
13
    /**
14
     * @var Chrisyue\PhpM3u8\M3u8\Core\Tag
15
     */
16
    public $tag;
17
18
    private $lines;
19
20
    public function setLines(LinesInterface $lines)
21
    {
22
        $this->lines = $lines;
23
24
        $this->tag->setLines($lines);
25
    }
26
27
    public function parse()
28
    {
29
        $result = $this->tag->parse();
30
        if (null === $result) {
31
            return;
32
        }
33
34
        $this->lines->goNext();
35
        $lineInfo = $this->lines->read();
36
        $result->uri = $lineInfo['value'];
37
38
        return $result;
39
    }
40
41
    public function dump($result)
42
    {
43
        $this->tag->dump($result);
44
45
        $this->lines->write(['value' => $result->uri]);
46
    }
47
48
    public function getSequence()
49
    {
50
        return $this->tag->getSequence();
51
    }
52
}
53