Passed
Push — master ( abded9...99e8d5 )
by Daniel
01:51
created

Csv::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * This file is part of the Csv-Machine package.
5
 *
6
 * (c) Dan McAdams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RoadBunch\Csv;
13
14
15
class Csv
16
{
17
    /** @var array */
18
    protected $rawData = [];
19
20
    /**
21
     * Csv constructor.
22
     *
23
     * Passed data array should be a two dimensional array only or an exception will be thrown
24
     * when the time comes to build the CSV
25
     *
26
     * $data = [
27
     *      ['first_name' => 'John', 'last_name' => 'Doe', 'employee_id' => '742617000027'],
28
     *      ['first_name' => 'Jane', 'last_name' => 'Jackson', 'employee_id' => '0003645'],
29
     *      ['first_name' => 'Dede', 'last_name' => 'Gore', 'OMG12324']
30
     * ];
31
     *
32
     * OR
33
     *
34
     * $data = [
35
     *      ['John', 'Doe', '742617000027'],
36
     *      ['Jane', 'Jackson', '01011970'],
37
     *      ['Dede', 'Gore', 'OMG1234']
38
     * ];
39
     *
40
     * @param array $data
41
     */
42 1
    public function __construct(array $data = [])
43
    {
44 1
        $this->rawData = $data;
45
    }
46
}