| @@ 1229-1238 (lines=10) @@ | ||
| 1226 | for ($i = 0; $i < $times; ++$i) { |
|
| 1227 | $args = [$this, $i]; |
|
| 1228 | ||
| 1229 | if ($fn instanceof \Closure) { |
|
| 1230 | $fn = $fn->bindTo($this); |
|
| 1231 | ||
| 1232 | \array_shift($args); |
|
| 1233 | ||
| 1234 | // It is faster than \call_user_func. |
|
| 1235 | $fn(...$args); |
|
| 1236 | } else { |
|
| 1237 | \call_user_func($fn, ...$args); |
|
| 1238 | } |
|
| 1239 | } |
|
| 1240 | ||
| 1241 | return $this; |
|
| @@ 1250-1259 (lines=10) @@ | ||
| 1247 | $cx = $this->newContext($n); |
|
| 1248 | $args = [$cx, $i, $n]; |
|
| 1249 | ||
| 1250 | if ($fn instanceof \Closure) { |
|
| 1251 | $fn = $fn->bindTo($cx); |
|
| 1252 | ||
| 1253 | \array_shift($args); |
|
| 1254 | ||
| 1255 | // It is faster than \call_user_func. |
|
| 1256 | $fn(...$args); |
|
| 1257 | } else { |
|
| 1258 | \call_user_func($fn, ...$args); |
|
| 1259 | } |
|
| 1260 | } |
|
| 1261 | ||
| 1262 | return $this; |
|