Skip to content

Commit eec3e36

Browse files
committed
Add getCurrentPathname method
1 parent 81ecc51 commit eec3e36

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/Csv.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Csv
1919
protected $handle;
2020
protected $pathDir;
2121
protected $filename;
22-
protected $currentFile;
22+
protected $currentPathname;
2323
protected $header;
2424
protected $maxLines;
2525
protected $delimiter;
@@ -91,8 +91,8 @@ protected function open()
9191
if ($this->fileNumber > 1) {
9292
$filename .= '-' . $this->fileNumber;
9393
}
94-
$this->currentFile = $this->pathDir . '/' . $filename . '.csv';
95-
$this->handle = \fopen($this->currentFile, 'wb'); //Binary is forced. EOL = "\n"
94+
$this->currentPathname = $this->pathDir . '/' . $filename . '.csv';
95+
$this->handle = \fopen($this->currentPathname, 'wb'); //Binary is forced. EOL = "\n"
9696
if (false === $this->handle) {
9797
throw new \Exception(sprintf('Error during the opening of the %s file', $this->filename));
9898
}
@@ -118,12 +118,12 @@ public function close()
118118
$this->handle = null;
119119

120120
if ($this->unixToDos) {
121-
passthru(sprintf('%s %s', $this->unixToDosPath, $this->currentFile), $returnVar);
121+
passthru(sprintf('%s %s', $this->unixToDosPath, $this->currentPathname), $returnVar);
122122
if (0 !== $returnVar) {
123123
throw new \Exception(sprintf('Unix2dos error (%s file)', $this->filename));
124124
}
125125
}
126-
$this->currentFile = null;
126+
$this->currentPathname = null;
127127
}
128128
}
129129

@@ -167,4 +167,13 @@ public function getTotalLines()
167167
{
168168
return $this->totalLines;
169169
}
170+
171+
/**
172+
* Gets the path to the current file
173+
* @return string
174+
*/
175+
public function getCurrentPathname()
176+
{
177+
return $this->currentPathname;
178+
}
170179
}

0 commit comments

Comments
 (0)