diff options
Diffstat (limited to 'it_pipe.class')
-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 611c2ad..54f4a5b 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -15,9 +15,9 @@ class it_pipe implements Iterator */ function __construct($p = array()) { - if ($p['data']) - $this->lines = is_array($p['data']) ? $p['data'] : explode("\n", rtrim($p['data'], "\n")); - else if ($p['cmd']) + if (array_key_exists('data', $p)) + $this->lines = is_array($p['data']) || $p['data'] === null ? (array)$p['data'] : explode("\n", rtrim($p['data'], "\n")); + else if (array_key_exists('cmd', $p)) $this->lines = strlen($data = it::exec($p['cmd'], $p['args'])) ? explode("\n", rtrim($data, "\n")) : array(); else foreach ((array)($p['fn'] ? $p['fn'] : "php://stdin") as $fn) |