summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class5
1 files changed, 3 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 5ab7e8a..8c7f92f 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -2,7 +2,7 @@
class it_pipe implements Iterator
{
- static $lastargfunc = array('explode' => 1, 'preg_match' => 1, 'preg_split' => 1, 'it__match' => 1, 'it__replace' => 1);
+ static $parampositions = array('explode' => 1, 'preg_match' => 1, 'preg_split' => 1, 'it__match' => 1, 'it__replace' => 1);
var $lines; # all lines currently in pipe
var $_valid;
@@ -29,7 +29,8 @@ function __construct($p = array())
*/
function __call($name, $params)
{
- list($parampos) = self::$lastargfunc[$name] ? array(count($params)) : array(0, array_unshift($params, ""));
+ $parampos = self::$parampositions[$name] ?: 0;
+ array_splice($params, $parampos, 0, [null]); # create room for inserted line arg
$func = ($t = it::match('(\w+)__(\w+)', $name)) ? array($t[0], $t[1]) : (method_exists($this, $name) ? array($this, $name) : $name);
foreach($this->lines as $i => $params[$parampos])