| @@ 83-97 (lines=15) @@ | ||
| 80 | * @param mixed ...$args Arguments |
|
| 81 | * @return integer |
|
| 82 | */ |
|
| 83 | public function executeAll(...$args) |
|
| 84 | { |
|
| 85 | if ($this->isEmpty()) { |
|
| 86 | return 0; |
|
| 87 | } |
|
| 88 | $n = 0; |
|
| 89 | do { |
|
| 90 | $cb = $this->extract(); |
|
| 91 | if ($cb) { |
|
| 92 | $cb(...$args); |
|
| 93 | ++$n; |
|
| 94 | } |
|
| 95 | } while (!$this->isEmpty()); |
|
| 96 | return $n; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| @@ 76-93 (lines=18) @@ | ||
| 73 | * @param array $args |
|
| 74 | * @return int |
|
| 75 | */ |
|
| 76 | public function executeAll(...$args) |
|
| 77 | { |
|
| 78 | if ($this->isEmpty()) { |
|
| 79 | return 0; |
|
| 80 | } |
|
| 81 | ||
| 82 | $n = 0; |
|
| 83 | do { |
|
| 84 | if ($cb = $this->shift()) { |
|
| 85 | $cb(...$args); |
|
| 86 | ++$n; |
|
| 87 | if ($cb instanceof CallbackWrapper) { |
|
| 88 | $cb->cancel(); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } while (!$this->isEmpty()); |
|
| 92 | return $n; |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * Return array |
|