Skip to content

Commit

Permalink
Merge pull request #4 from handcraftedinthealps/feature/upgrade-pr
Browse files Browse the repository at this point in the history
Add some open pr from original repository to the fork
  • Loading branch information
alexander-schranz authored Nov 26, 2021
2 parents 2982675 + 3876877 commit 6504655
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ use Goodby\CSV\Import\Standard\Lexer;
use Goodby\CSV\Import\Standard\Interpreter;
use Goodby\CSV\Import\Standard\LexerConfig;

$temperature = array();
$temperature = [];

$config = new LexerConfig();
$config->setDelimiter("\t");
$lexer = new Lexer($config);

$interpreter = new Interpreter();
$interpreter->addObserver(function(array $row) use (&$temperature) {
$temperature[] = array(
$temperature[] = [
'temperature' => $row[0],
'city' => $row[1],
);
];
});

$lexer->parse('temperature.tsv', $interpreter);
Expand All @@ -201,11 +201,11 @@ use Goodby\CSV\Export\Standard\ExporterConfig;
$config = new ExporterConfig();
$exporter = new Exporter($config);

$exporter->export('php://output', array(
array('1', 'alice', '[email protected]'),
array('2', 'bob', '[email protected]'),
array('3', 'carol', '[email protected]'),
));
$exporter->export('php://output', [
['1', 'alice', '[email protected]'],
['2', 'bob', '[email protected]'],
['3', 'carol', '[email protected]'],
]);
```


Expand Down Expand Up @@ -240,10 +240,10 @@ use Goodby\CSV\Export\Standard\ExporterConfig;

use Goodby\CSV\Export\Standard\Collection\CallbackCollection;

$data = array();
$data[] = array('user', 'name1');
$data[] = array('user', 'name2');
$data[] = array('user', 'name3');
$data = [];
$data[] = ['user', 'name1'];
$data[] = ['user', 'name2'];
$data[] = ['user', 'name3'];

$collection = new CallbackCollection($data, function($row) {
// apply custom format to the row
Expand Down
2 changes: 1 addition & 1 deletion src/Goodby/CSV/Export/Standard/CsvFileObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function fputcsv($fields, $delimiter = null, $enclosure = null, $escape =
$line = rtrim($line, "\n"). $this->newline;

// if the enclosure was '' | false
if (empty($enclosure)) {
if (empty($enclosure) || $enclosure === "\0") {
$line = str_replace("\0", '', $line);
}

Expand Down

0 comments on commit 6504655

Please sign in to comment.