summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schneider2021-02-03 12:00:51 +0100
committerChristian Schneider2021-02-03 12:00:51 +0100
commit1b94225ce6d8420718e21d0834211a5a1224c5e8 (patch)
tree8961c9b72f61a27a52a7d1ad0fe7be348a2ddeeb
parent21ccdefc4aea4c2439f7d41ece7d8216d8ba8b40 (diff)
downloaditools-1b94225ce6d8420718e21d0834211a5a1224c5e8.tar.gz
itools-1b94225ce6d8420718e21d0834211a5a1224c5e8.tar.bz2
itools-1b94225ce6d8420718e21d0834211a5a1224c5e8.zip
Code cleanup: Replace call_user_func* with normal function call equivalent
-rw-r--r--it.class2
-rw-r--r--it_html.class2
-rw-r--r--it_pipe.class4
-rw-r--r--it_text.class2
-rw-r--r--it_url.class4
5 files changed, 7 insertions, 7 deletions
diff --git a/it.class b/it.class
index dd62dd7..1c5d403 100644
--- a/it.class
+++ b/it.class
@@ -472,7 +472,7 @@ static function match($pattern, $string, $p = null)
else if (count($m) == 2) # one capture
$result = $m[1];
else if ($p['all'] && !$p['pattern_order']) # captures, reorder pattern_order to set_order but without first element
- $result = call_user_func_array('array_map', array_merge(array(null), array_slice($m, 1)));
+ $result = array_map(null, ...array_slice($m, 1));
else # captures, don't return first element (matched string)
$result = array_slice($m, 1);
diff --git a/it_html.class b/it_html.class
index 057c410..fb26544 100644
--- a/it_html.class
+++ b/it_html.class
@@ -129,7 +129,7 @@ function __construct($p = array())
foreach (explode(',', $this->p['staticallycallable']) as $func)
{
if ($func && !function_exists($func))
- $code[$func] = "function $func(...\$args) { return call_user_func_array(array(&\$GLOBALS['{$this->p['name']}'], '$func'), \$args); }";
+ $code[$func] = "function $func(...\$args) { return \$GLOBALS['{$this->p['name']}']->$func(...\$args); }";
}
eval(implode('', (array)$code));
diff --git a/it_pipe.class b/it_pipe.class
index 3153dae..2fe93db 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -32,10 +32,10 @@ function __call($name, $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);
+ $func = ($t = it::match('(\w+)__(\w+)', $name)) ? [$t[0], $t[1]] : (method_exists($this, $name) ? [$this, $name] : $name);
foreach($this->lines as $i => $params[$parampos])
- $this->lines[$i] = call_user_func_array($func, $params);
+ $this->lines[$i] = $func(...$params);
return $this;
}
diff --git a/it_text.class b/it_text.class
index d91ed27..07b0e7a 100644
--- a/it_text.class
+++ b/it_text.class
@@ -243,7 +243,7 @@ static function transmogrify($text, $values = null, $label = null, $allowedfuncs
}
}
else
- $value = (list($func, $arg) = it::match('^([\w:]+)\((.*)\)$', $part)) && isset($allowedfuncs[$func]) ? call_user_func($func, $arg) : "{" . $part . "}";
+ $value = (list($func, $arg) = it::match('^([\w:]+)\((.*)\)$', $part)) && isset($allowedfuncs[$func]) ? $func($arg) : "{" . $part . "}";
$result .= $GLOBALS['debug_texts'] ? "</span>$value<span style='background:#8F8'>" : $value;
}
diff --git a/it_url.class b/it_url.class
index 0b90b1b..f00f5b6 100644
--- a/it_url.class
+++ b/it_url.class
@@ -623,9 +623,9 @@ static function get_cache($p = array())
$dstpath = "$path.preprocesstmp";
if (is_array($p['preprocess']) && $p['preprocess']['function']) # Needs is_array as it can be a string where dereferencing gives first character!
- call_user_func($p['preprocess']['function'], array('in' => $srcpath, 'out' => $dstpath) + $p['preprocess']);
+ $p['preprocess']['function'](['in' => $srcpath, 'out' => $dstpath] + $p['preprocess']);
else
- call_user_func($p['preprocess'], $srcpath, $dstpath);
+ $p['preprocess']($srcpath, $dstpath);
if (!($success = @filesize($dstpath) && @rename($dstpath, $path)))
{