Completed
Push — master ( 05283a...49c7da )
by Victor
12s
created

TextFileWriter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
c 1
b 0
f 0
wmc 2
lcom 0
cbo 2
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A writeFile() 0 8 2
1
<?php
2
3
namespace LazyEight\DiTesto;
4
5
use LazyEight\DiTesto\Exceptions\IOException;
6
use LazyEight\DiTesto\Interfaces\FileWriterInterface;
7
use LazyEight\DiTesto\Interfaces\WritableFileInterface;
8
9
class TextFileWriter implements FileWriterInterface
10
{
11
    /**
12
     * @inheritDoc
13
     */
14 2
    public function writeFile(WritableFileInterface $file)
15
    {
16 2
        if (!$file->isWritable()) {
17 1
            throw new IOException("Can't write the file. Permission denied");
18
        }
19
20 1
        $file->write();
21 1
    }
22
}
23