CSV::array()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace HexMakina\LocalFS\Text;
4
5
class CSV extends TextFile
6
{
7
8
9
  // T — Gets line from file pointer and parse for CSV fields
10
  // fgetcsv ( resource $handle [, int $length = 0 [, string $delimiter = "," [, string $enclosure = '"' [, string $escape = "\\" ]]]] ) : array
11
12
  // fputcsv ( resource $handle , array $fields [, string $delimiter = "," [, string $enclosure = '"' [, string $escape_char = "\\" ]]] ) : int
13
  /*
14
<?php
15
16
$list = array (
17
    array('aaa', 'bbb', 'ccc', 'dddd'),
18
    array('123', '456', '789'),
19
    array('"aaa"', '"bbb"')
20
);
21
22
$fp = fopen('file.csv', 'w');
23
24
foreach ($list as $fields) {
25
    fputcsv($fp, $fields);
26
}
27
28
fclose($fp);
29
30
31
*/
32
    function array() : array
33
    {
34
        return array_map('str_getcsv', parent::array());
35
    }
36
}
37