ErasingWriter::write()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 2
eloc 3
nc 1
nop 3
crap 2
1
<?php
2
3
namespace TextFile\Writer;
4
5
/**
6
 * Class ErasingWriter
7
 *
8
 * @package TextFile\Writer
9
 */
10
class ErasingWriter implements WriterInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 4
    public function write(\SplFileObject $file, $text, $newLineAtEnd = false)
16
    {
17 4
        $file->fwrite($text . ($newLineAtEnd ? PHP_EOL : ''));
18
19 4
        return $file;
20
    }
21
}
22