Completed
Push — master ( 49c7da...61b9c9 )
by Victor
13s
created

FileReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A readFile() 0 8 2
1
<?php
2
3
namespace LazyEight\DiTesto;
4
5
use LazyEight\DiTesto\Exceptions\IOException;
6
use LazyEight\DiTesto\Interfaces\FileInterface;
7
use LazyEight\DiTesto\Interfaces\FileReaderInterface;
8
use LazyEight\DiTesto\Interfaces\FileSystem\FileSystemHandlerInterface;
9
10
class FileReader implements FileReaderInterface
11
{
12
    /**
13
     * @inheritDoc
14
     */
15
    public function readFile(FileInterface $file, FileSystemHandlerInterface $fileSystemHandler)
16
    {
17
        if (!$fileSystemHandler->isReadable($file->getPath())) {
18
            throw new IOException("Error, can't read the file. The file not exist or is not readable.");
19
        }
20
21
        $file->setRawContent($fileSystemHandler->read($file->getPath()));
22
    }
23
}
24