modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-09-12 20:47:20 +04:00
parent 2ce513c174
commit 2ba1e535fd
1 changed files with 28 additions and 24 deletions

View File

@ -220,36 +220,37 @@ class func {
} }
if (is_string($func)) { if (is_string($func)) {
if (!self::_parse_c_static($func, $c, $f, $bound)) return false; if (!self::_parse_c_static($func, $c, $f, $bound)) return false;
$func = [$c, $f]; $cf = [$c, $f];
} elseif (is_array($func)) { } elseif (is_array($func)) {
if (!array_key_exists(0, $func)) return false; $cf = $func;
$c = $func[0]; if (!array_key_exists(0, $cf)) return false;
$c = $cf[0];
if ($c === false) return false; if ($c === false) return false;
if (is_object($c)) $c = get_class($c); if (is_object($c)) $c = get_class($c);
if (is_string($c)) { if (is_string($c)) {
if (self::_is_invalid($c)) return false; if (self::_is_invalid($c)) return false;
if (self::_parse_class_s($c, $c, $f)) { if (self::_parse_class_s($c, $c, $f)) {
$func[0] = $c; $cf[0] = $c;
if ($f !== null) { if ($f !== null) {
# ["class::method"] --> ["class", "method"] # ["class::method"] --> ["class", "method"]
array_splice($func, 1, 0, [$f]); array_splice($cf, 1, 0, [$f]);
} }
$bound = true; $bound = true;
} elseif (self::_parse_c_static($c, $c, $f, $bound)) { } elseif (self::_parse_c_static($c, $c, $f, $bound)) {
# ["::method"] --> [null, "method"] # ["::method"] --> [null, "method"]
array_splice($func, 0, 0, [null]); array_splice($cf, 0, 0, [null]);
$func[1] = $f; $cf[1] = $f;
} else { } else {
$func[0] = $c; $cf[0] = $c;
$bound = is_string($c); $bound = is_string($c);
} }
} else { } else {
$func[0] = null; $cf[0] = null;
$bound = false; $bound = false;
} }
# #
if (!array_key_exists(1, $func)) return false; if (!array_key_exists(1, $cf)) return false;
$f = $func[1]; $f = $cf[1];
if (!is_string($f)) return false; if (!is_string($f)) return false;
if (self::_parse_c_static($f, $rc, $f, $rbound)) { if (self::_parse_c_static($f, $rc, $f, $rbound)) {
if ($rc !== null && $c === null) { if ($rc !== null && $c === null) {
@ -262,7 +263,7 @@ class func {
if (self::_parse_method($f)) return false; if (self::_parse_method($f)) return false;
self::_parse_static($f); self::_parse_static($f);
} }
$func[1] = $f; $cf[1] = $f;
} else { } else {
return false; return false;
} }
@ -281,6 +282,7 @@ class func {
$reason = "$msg: not bound"; $reason = "$msg: not bound";
} }
} }
$func = $cf;
return true; return true;
} }
@ -353,37 +355,38 @@ class func {
} }
if (is_string($func)) { if (is_string($func)) {
if (!self::_parse_c_method($func, $c, $f, $bound)) return false; if (!self::_parse_c_method($func, $c, $f, $bound)) return false;
$func = [$c, $f]; $cf = [$c, $f];
} elseif (is_array($func)) { } elseif (is_array($func)) {
if (!array_key_exists(0, $func)) return false; $cf = $func;
$c = $func[0]; if (!array_key_exists(0, $cf)) return false;
$c = $cf[0];
if ($c === false) return false; if ($c === false) return false;
if (is_object($c)) { if (is_object($c)) {
$bound = true; $bound = true;
} elseif (is_string($c)) { } elseif (is_string($c)) {
if (self::_is_invalid($c)) return false; if (self::_is_invalid($c)) return false;
if (self::_parse_class_m($c, $c, $f)) { if (self::_parse_class_m($c, $c, $f)) {
$func[0] = $c; $cf[0] = $c;
if ($f !== null) { if ($f !== null) {
# ["class->method"] --> ["class", "method"] # ["class->method"] --> ["class", "method"]
array_splice($func, 1, 0, [$f]); array_splice($cf, 1, 0, [$f]);
} }
$bound = true; $bound = true;
} elseif (self::_parse_c_method($c, $c, $f, $bound)) { } elseif (self::_parse_c_method($c, $c, $f, $bound)) {
# ["->method"] --> [null, "method"] # ["->method"] --> [null, "method"]
array_splice($func, 0, 0, [null]); array_splice($cf, 0, 0, [null]);
$func[1] = $f; $cf[1] = $f;
} else { } else {
$func[0] = $c; $cf[0] = $c;
$bound = is_string($c); $bound = is_string($c);
} }
} else { } else {
$func[0] = null; $cf[0] = null;
$bound = false; $bound = false;
} }
# #
if (!array_key_exists(1, $func)) return false; if (!array_key_exists(1, $cf)) return false;
$f = $func[1]; $f = $cf[1];
if (!is_string($f)) return false; if (!is_string($f)) return false;
if (self::_parse_c_method($f, $rc, $f, $rbound)) { if (self::_parse_c_method($f, $rc, $f, $rbound)) {
if ($rc !== null && $c === null) { if ($rc !== null && $c === null) {
@ -396,7 +399,7 @@ class func {
if (self::_parse_static($f)) return false; if (self::_parse_static($f)) return false;
self::_parse_method($f); self::_parse_method($f);
} }
$func[1] = $f; $cf[1] = $f;
} else { } else {
return false; return false;
} }
@ -415,6 +418,7 @@ class func {
$reason = "$msg: not bound"; $reason = "$msg: not bound";
} }
} }
$func = $cf;
return true; return true;
} }