Completed
Pull Request — develop (#27)
by Chris
10:40
created

StreamInf   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 14 2
A dump() 0 6 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\M3u8\Core;
4
5
/**
6
 * @Annotation
7
 * @Target("PROPERTY")
8
 */
9
class StreamInf extends Tag
10
{
11
    public function parse()
12
    {
13
        $result = parent::parse();
14
15
        if (null === $result) {
16
            return;
17
        }
18
19
        $this->getStream()->next();
20
        $lineInfo = $this->getStream()->read();
21
        $result->uri = $lineInfo['value'];
22
23
        return $result;
24
    }
25
26
    public function dump($result)
27
    {
28
        parent::dump($result);
29
30
        $this->getStream()->write(['value' => $result->uri]);
31
    }
32
}
33