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

FileReader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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