diff --git a/composer.json b/composer.json index 01bc304..5c0e58b 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,9 @@ ], "require": { "php": ">=7.4", + "ext-ctype": "*", "ext-json": "*", - "fmizzell/maquina": "^1.1.1", - "getdkan/contracts": "^1.1.3" + "fmizzell/maquina": "^1.1.1" }, "require-dev": { "phpunit/phpunit": "^9.6", diff --git a/src/Parser/Csv.php b/src/Parser/Csv.php index 86419b4..3ab70d9 100644 --- a/src/Parser/Csv.php +++ b/src/Parser/Csv.php @@ -3,9 +3,8 @@ namespace CsvParser\Parser; -use Contracts\ParserInterface; -use Maquina\StateMachine\MachineOfMachines; use CsvParser\Parser\StateMachine as sm; +use Maquina\StateMachine\MachineOfMachines; class Csv implements ParserInterface, \JsonSerializable { @@ -49,7 +48,7 @@ public function __construct($delimiter, $quote, $escape, array $record_end) $this->machine->stopRecording(); } - public function feed(string $chunk) + public function feed(string $chunk): void { if (strlen($chunk) > 0) { $chars = str_split($chunk); @@ -104,7 +103,7 @@ public function reset(): void $this->quoted = false; } - public function finish() + public function finish(): void { // There will be csv strings that do not end in a "end of record" char. // This will flush them. diff --git a/src/Parser/ParserInterface.php b/src/Parser/ParserInterface.php new file mode 100644 index 0000000..e06055d --- /dev/null +++ b/src/Parser/ParserInterface.php @@ -0,0 +1,40 @@ +