From 2ba1e535fd66be2e96a8821b7dda24ad364ba90a Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 12 Sep 2024 20:47:20 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- wip/php/func.php | 52 ++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/wip/php/func.php b/wip/php/func.php index 965d2f8..1444ce0 100644 --- a/wip/php/func.php +++ b/wip/php/func.php @@ -220,36 +220,37 @@ class func { } if (is_string($func)) { if (!self::_parse_c_static($func, $c, $f, $bound)) return false; - $func = [$c, $f]; + $cf = [$c, $f]; } elseif (is_array($func)) { - if (!array_key_exists(0, $func)) return false; - $c = $func[0]; + $cf = $func; + if (!array_key_exists(0, $cf)) return false; + $c = $cf[0]; if ($c === false) return false; if (is_object($c)) $c = get_class($c); if (is_string($c)) { if (self::_is_invalid($c)) return false; if (self::_parse_class_s($c, $c, $f)) { - $func[0] = $c; + $cf[0] = $c; if ($f !== null) { # ["class::method"] --> ["class", "method"] - array_splice($func, 1, 0, [$f]); + array_splice($cf, 1, 0, [$f]); } $bound = true; } elseif (self::_parse_c_static($c, $c, $f, $bound)) { # ["::method"] --> [null, "method"] - array_splice($func, 0, 0, [null]); - $func[1] = $f; + array_splice($cf, 0, 0, [null]); + $cf[1] = $f; } else { - $func[0] = $c; + $cf[0] = $c; $bound = is_string($c); } } else { - $func[0] = null; + $cf[0] = null; $bound = false; } # - if (!array_key_exists(1, $func)) return false; - $f = $func[1]; + if (!array_key_exists(1, $cf)) return false; + $f = $cf[1]; if (!is_string($f)) return false; if (self::_parse_c_static($f, $rc, $f, $rbound)) { if ($rc !== null && $c === null) { @@ -262,7 +263,7 @@ class func { if (self::_parse_method($f)) return false; self::_parse_static($f); } - $func[1] = $f; + $cf[1] = $f; } else { return false; } @@ -281,6 +282,7 @@ class func { $reason = "$msg: not bound"; } } + $func = $cf; return true; } @@ -353,37 +355,38 @@ class func { } if (is_string($func)) { if (!self::_parse_c_method($func, $c, $f, $bound)) return false; - $func = [$c, $f]; + $cf = [$c, $f]; } elseif (is_array($func)) { - if (!array_key_exists(0, $func)) return false; - $c = $func[0]; + $cf = $func; + if (!array_key_exists(0, $cf)) return false; + $c = $cf[0]; if ($c === false) return false; if (is_object($c)) { $bound = true; } elseif (is_string($c)) { if (self::_is_invalid($c)) return false; if (self::_parse_class_m($c, $c, $f)) { - $func[0] = $c; + $cf[0] = $c; if ($f !== null) { # ["class->method"] --> ["class", "method"] - array_splice($func, 1, 0, [$f]); + array_splice($cf, 1, 0, [$f]); } $bound = true; } elseif (self::_parse_c_method($c, $c, $f, $bound)) { # ["->method"] --> [null, "method"] - array_splice($func, 0, 0, [null]); - $func[1] = $f; + array_splice($cf, 0, 0, [null]); + $cf[1] = $f; } else { - $func[0] = $c; + $cf[0] = $c; $bound = is_string($c); } } else { - $func[0] = null; + $cf[0] = null; $bound = false; } # - if (!array_key_exists(1, $func)) return false; - $f = $func[1]; + if (!array_key_exists(1, $cf)) return false; + $f = $cf[1]; if (!is_string($f)) return false; if (self::_parse_c_method($f, $rc, $f, $rbound)) { if ($rc !== null && $c === null) { @@ -396,7 +399,7 @@ class func { if (self::_parse_static($f)) return false; self::_parse_method($f); } - $func[1] = $f; + $cf[1] = $f; } else { return false; } @@ -415,6 +418,7 @@ class func { $reason = "$msg: not bound"; } } + $func = $cf; return true; }