From 58a0444eabccaba87f3050b7f264e404f0cec6d4 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 29 Jun 2012 13:47:28 +0000 Subject: stdout option, renamed save() to write() to reflect this --- it_pipe.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'it_pipe.class') diff --git a/it_pipe.class b/it_pipe.class index d002b5b..5e89123 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -196,12 +196,12 @@ function pipe($cmd) /** * Save our contents in a file - * @param $fn filename to save in + * @param $fn filename to save in, omit or null for stdout * @param $append append to file (boolean) */ -function save($fn, $append = false) +function write($fn = null, $append = false) { - file_put_contents($fn, $this->lines ? join("\n", $this->lines) . "\n" : "", $append ? FILE_APPEND : 0); + file_put_contents($fn === null ? "php://stdout" : $fn, $this->lines ? join("\n", $this->lines) . "\n" : "", $append ? FILE_APPEND : 0); return $this; } -- cgit v1.2.3