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

FileWriter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A writeFile() 0 4 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