Test Failed
Push — master ( 4d08be...259b26 )
by Andrew
01:16
created

FileWriter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 11
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A write() 0 8 2
1
<?php
2
3
namespace CsvParser\Writer;
4
use CsvParser\Exception;
5
6
class FileWriter implements WriterInterface
7
{
8 1
    public static function write(\CsvParser\Parser $parser, \CsvParser\Csv $csv, $filename='')
9
    {
10 1
        if ( ! $filename) {
11
            throw new Exception('Please provide a file name to write to');
12
        }
13 1
        $file = $parser->toString($csv);
14 1
        return file_put_contents($filename, $file);
15
    }
16
}
17