summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2012-06-29 13:47:28 +0000
committerUrban Müller2012-06-29 13:47:28 +0000
commit58a0444eabccaba87f3050b7f264e404f0cec6d4 (patch)
tree8ab151004c43130201c9abd1dc109c209dfac1d9
parent8f988e6449488f2c58f9589399a582804c52d31f (diff)
downloaditools-58a0444eabccaba87f3050b7f264e404f0cec6d4.tar.gz
itools-58a0444eabccaba87f3050b7f264e404f0cec6d4.tar.bz2
itools-58a0444eabccaba87f3050b7f264e404f0cec6d4.zip
stdout option, renamed save() to write() to reflect this
-rw-r--r--it_pipe.class6
1 files changed, 3 insertions, 3 deletions
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;
}