diff options
author | Urban Müller | 2012-06-29 13:47:28 +0000 |
---|---|---|
committer | Urban Müller | 2012-06-29 13:47:28 +0000 |
commit | 58a0444eabccaba87f3050b7f264e404f0cec6d4 (patch) | |
tree | 8ab151004c43130201c9abd1dc109c209dfac1d9 | |
parent | 8f988e6449488f2c58f9589399a582804c52d31f (diff) | |
download | itools-58a0444eabccaba87f3050b7f264e404f0cec6d4.tar.gz itools-58a0444eabccaba87f3050b7f264e404f0cec6d4.tar.bz2 itools-58a0444eabccaba87f3050b7f264e404f0cec6d4.zip |
stdout option, renamed save() to write() to reflect this
-rw-r--r-- | it_pipe.class | 6 |
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; } |