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

FileStream::putLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 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