Completed
Pull Request — master (#13)
by Victor
01:57
created

FileWriter::writeFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace LazyEight\DiTesto;
4
5
use LazyEight\DiTesto\Exceptions\FileSystemException;
6
use LazyEight\DiTesto\Interfaces\FileInterface;
7
use LazyEight\DiTesto\Interfaces\FileSystem\FileSystemHandlerInterface;
8
use LazyEight\DiTesto\Interfaces\FileWriterInterface;
9
use LazyEight\DiTesto\Interfaces\WritableFileInterface;
10
11
class FileWriter implements FileWriterInterface
12
{
13
    /**
14
     * @var AbstractFile
15
     */
16
    private $file;
17
18
    /**
19
     * @var FileSystemHandlerInterface
20
     */
21
    private $handler;
22
23
    /**
24
     * FileWriter constructor.
25
     * @param AbstractFile $file
26
     * @param FileSystemHandlerInterface $handler
27
     */
28 1
    public function __construct(AbstractFile $file, FileSystemHandlerInterface $handler)
29
    {
30 1
        $this->file = $file;
31 1
        $this->handler = $handler;
32 1
    }
33
34 2
    public function writeFile()
35
    {
36 2
        $this->handler->write($this->file->getRawContent());
37 1
    }
38
}
39