◆ close()
Definition at line 76 of file class.ilCSVReader.php.
76 : bool
77 {
78 ini_set(self::AUTO_DETECT_LINE_ENDINGS, $this->line_ends);
79
80 return fclose($this->file_resource);
81 }
◆ getCsvAsArray()
| ilCSVReader::getCsvAsArray |
( |
| ) |
|
◆ open()
| ilCSVReader::open |
( |
string |
$path_to_file | ) |
|
Definition at line 63 of file class.ilCSVReader.php.
63 : bool
64 {
65 $this->line_ends = ini_get(self::AUTO_DETECT_LINE_ENDINGS);
66 ini_set(self::AUTO_DETECT_LINE_ENDINGS, true);
67
69
70 if (!is_resource($this->file_resource)) {
71 throw new RuntimeException('sould not open stream to ' . $path_to_file);
72 }
73 return true;
74 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
References ilUtil\stripSlashes().
◆ parse()
Definition at line 34 of file class.ilCSVReader.php.
34 : void
35 {
36 $row = 0;
37
38 while (($line = fgetcsv($this->file_resource, $this->length, $this->separator)) !== false) {
39 $line_count = count($line);
40 for ($col = 0; $col < $line_count; $col++) {
41 $this->data[$row][$col] = $this->
unquote($line[$col]);
42 }
43
44 ++$row;
45 }
46 }
References unquote().
Referenced by getCsvAsArray().
◆ setDelimiter()
| ilCSVReader::setDelimiter |
( |
string |
$a_del | ) |
|
◆ setLength()
| ilCSVReader::setLength |
( |
int |
$a_length | ) |
|
◆ setSeparator()
| ilCSVReader::setSeparator |
( |
string |
$a_sep | ) |
|
◆ unquote()
| ilCSVReader::unquote |
( |
string |
$a_str | ) |
|
|
private |
Definition at line 90 of file class.ilCSVReader.php.
90 : string
91 {
92 return str_replace($this->delimiter . $this->delimiter, $this->delimiter, $a_str);
93 }
Referenced by parse().
◆ $data
| array ilCSVReader::$data = [] |
|
private |
◆ $delimiter
| string ilCSVReader::$delimiter = '""' |
|
private |
◆ $file_resource
| ilCSVReader::$file_resource |
|
private |
◆ $length
| int ilCSVReader::$length = 1024 |
|
private |
◆ $line_ends
| string ilCSVReader::$line_ends |
|
private |
◆ $separator
| string ilCSVReader::$separator = ';' |
|
private |
◆ AUTO_DETECT_LINE_ENDINGS
| const ilCSVReader::AUTO_DETECT_LINE_ENDINGS = "auto_detect_line_endings" |
The documentation for this class was generated from the following file: