diff options
author | Urban Müller | 2012-02-01 14:42:04 +0000 |
---|---|---|
committer | Urban Müller | 2012-02-01 14:42:04 +0000 |
commit | 4bb571a705853eddc9b7fed784142e85f8b2d7d1 (patch) | |
tree | 9150f7c281e8d0a90136a1c8791be90f6b27c25f | |
parent | f119638daa4df426a194e2e83eb754dad3d68550 (diff) | |
download | itools-4bb571a705853eddc9b7fed784142e85f8b2d7d1.tar.gz itools-4bb571a705853eddc9b7fed784142e85f8b2d7d1.tar.bz2 itools-4bb571a705853eddc9b7fed784142e85f8b2d7d1.zip |
allow append, allow chaining
-rw-r--r-- | it_pipe.class | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class index 36e4f63..6847a5d 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -194,10 +194,14 @@ function pipe($cmd) /** * Save our contents in a file + * @param $fn filename to save in + * @param $append append to file (boolean) */ -function save($fn) +function save($fn, $append = false) { - file_put_contents($fn, $this->lines ? join("\n", $this->lines) . "\n" : ""); + file_put_contents($fn, $this->lines ? join("\n", $this->lines) . "\n" : "", $append ? FILE_APPEND : 0); + + return $this; } } |