From 4f7f5e4b1fd1077ad134860b32203810ef24c0ce Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 13 Jan 2021 16:21:03 +0100 Subject: Unified join to always use implode --- it_pipe.class | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'it_pipe.class') diff --git a/it_pipe.class b/it_pipe.class index 967cc77..3153dae 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -42,7 +42,7 @@ function __call($name, $params) function __toString() { - return is_array($this->lines) ? join("\n", $this->lines) . "\n" : ""; + return is_array($this->lines) ? implode("\n", $this->lines) . "\n" : ""; } @@ -117,7 +117,7 @@ function utf8() function cut($picks) { foreach ($this->lines as $idx => $line) - $this->lines[$idx] = join("\t", it::filter_keys(explode("\t", $line), $picks, ['reorder' => true])); + $this->lines[$idx] = implode("\t", it::filter_keys(explode("\t", $line), $picks, ['reorder' => true])); return $this; } @@ -243,7 +243,7 @@ function pipe($cmd, ...$args) $descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w")); $process = proc_open($cmd, $descriptors, $pipes); - fwrite($pipes[0], join("\n", $this->lines) . ($this->lines ? "\n" :"")); + fwrite($pipes[0], implode("\n", $this->lines) . ($this->lines ? "\n" :"")); fclose($pipes[0]); $out = stream_get_contents($pipes[1]); @@ -261,7 +261,7 @@ function pipe($cmd, ...$args) */ function write($fn = null, $append = false) { - it::file_put_contents($fn === null ? "php://stdout" : $fn, $this->lines ? join("\n", $this->lines) . "\n" : "", $append ? FILE_APPEND : 0); + it::file_put_contents($fn === null ? "php://stdout" : $fn, $this->lines ? implode("\n", $this->lines) . "\n" : "", $append ? FILE_APPEND : 0); return $this; } -- cgit v1.2.3