Completed
Pull Request — develop (#27)
by Chris
02:25
created

FileStream   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 29
c 0
b 0
f 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getLine() 0 4 1
A putLine() 0 4 1
A goNext() 0 4 1
A isValid() 0 4 1
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Stream;
4
5
class FileStream implements StreamInterface
6
{
7
    private $file;
8
9
    public function __construct(\SplFileObject $file)
10
    {
11
        $this->file = $file;
12
    }
13
14
    public function goNext()
15
    {
16
        $this->file->next();
17
    }
18
19
    public function isValid()
20
    {
21
        return $this->file->valid();
22
    }
23
24
    public function getLine()
25
    {
26
        return trim($this->file->current());
27
    }
28
29
    public function putLine($line)
30
    {
31
        $this->file->fwrite($line."\n");
32
    }
33
}
34