Skip to content

Commit 420ae04

Browse files
authored
Merge pull request #1 from fmizzell/contracts-compatible
Becoming compatible with contracts interfaces.
2 parents 19d6353 + b5a8d4f commit 420ae04

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
}
1515
},
1616
"require": {
17-
"fmizzell/maquina": "1.0.0"
17+
"fmizzell/maquina": "1.0.0",
18+
"fmizzell/contracts": "0.0.2"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^7.4"

src/Parser/Csv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function activateTrailingDelimiter() {
4848
$this->trailingDelimiter = TRUE;
4949
}
5050

51-
public static function getParser($delimiter, $quote, $escape, array $record_end)
51+
public static function getParser($delimiter = ",", $quote = '"', $escape = "\\", $record_end = ["\n", "\r"])
5252
{
5353
return new self($delimiter, $quote, $escape, $record_end);
5454
}

src/Parser/ICsv.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,9 @@
44
namespace CsvParser\Parser;
55

66

7-
interface ICsv
8-
{
9-
public static function getParser($delimiter, $quote, $escape, array $record_end);
10-
11-
/**
12-
* Feed the parser a chunck of the csv formatted string to be parsed.
13-
*
14-
* @param string $chunk
15-
* Part or all of a csv file.
16-
*/
17-
public function feed($chunk);
18-
19-
/**
20-
* Gets a record.
21-
*/
22-
public function getRecord();
7+
use Contracts\Parser;
238

24-
/**
25-
* It sets the parser's state to its initial state.
26-
*/
27-
public function reset();
28-
29-
/**
30-
* Informs the parser that we are done.
31-
*/
32-
public function finish();
9+
interface ICsv extends Parser
10+
{
11+
public static function getParser($delimiter = ",", $quote = '"', $escape = "\\", $record_end = ["\n", "\r"]);
3312
}

0 commit comments

Comments
 (0)