Completed
Push — master ( 005d42...c6a537 )
by ARCANEDEV
9s
created

CsvExporter::loadOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
ccs 0
cts 12
cp 0
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 2
1
<?php namespace Arcanedev\LaravelExcel\Exporters;
2
3
use Box\Spout\Common\Type;
4
use Illuminate\Support\Arr;
5
6
/**
7
 * Class     CsvExporter
8
 *
9
 * @package  Arcanedev\LaravelExcel\Exporter
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class CsvExporter extends AbstractExporter
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /** @var string */
19
    protected $type = Type::CSV;
20
21
    /** @var \Box\Spout\Writer\CSV\Writer */
22
    protected $writer;
23
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Other Functions
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * Load the writer options.
30
     */
31
    protected function loadOptions()
32
    {
33
        $this->writer
34
            ->setFieldDelimiter(
35
                Arr::get($this->options, 'field-delimiter', ';')
36
            )
37
            ->setFieldEnclosure(
38
                Arr::get($this->options, 'field-enclosure', '"')
39
            )
40
            ->setShouldAddBOM(
41
                Arr::get($this->options, 'add-bom', true)
42
            );
43
    }
44
}
45