Lines Matching refs:this

56         $this->iterable = Create::iterFor($iterable);
59 $this->concurrency = $config['concurrency'];
63 $this->onFulfilled = $config['fulfilled'];
67 $this->onRejected = $config['rejected'];
74 if ($this->aggregate) {
75 return $this->aggregate;
79 $this->createPromise();
81 $this->iterable->rewind();
82 $this->refillPending();
88 $this->aggregate->reject($e);
94 $this->aggregate->reject($e);
101 return $this->aggregate;
106 $this->mutex = false;
107 $this->aggregate = new Promise(function () {
108 if ($this->checkIfFinished()) {
111 reset($this->pending);
114 while ($promise = current($this->pending)) {
115 next($this->pending);
117 if (Is::settled($this->aggregate)) {
125 $this->iterable = $this->concurrency = $this->pending = null;
126 $this->onFulfilled = $this->onRejected = null;
127 $this->nextPendingIndex = 0;
130 $this->aggregate->then($clearFn, $clearFn);
135 if (!$this->concurrency) {
137 while ($this->addPending() && $this->advanceIterator());
142 $concurrency = is_callable($this->concurrency)
143 ? call_user_func($this->concurrency, count($this->pending))
144 : $this->concurrency;
145 $concurrency = max($concurrency - count($this->pending), 0);
151 $this->addPending();
157 && $this->advanceIterator()
158 && $this->addPending());
163 if (!$this->iterable || !$this->iterable->valid()) {
167 $promise = Create::promiseFor($this->iterable->current());
168 $key = $this->iterable->key();
172 $idx = $this->nextPendingIndex++;
174 $this->pending[$idx] = $promise->then(
176 if ($this->onFulfilled) {
178 $this->onFulfilled,
181 $this->aggregate
184 $this->step($idx);
187 if ($this->onRejected) {
189 $this->onRejected,
192 $this->aggregate
195 $this->step($idx);
206 if ($this->mutex) {
210 $this->mutex = true;
213 $this->iterable->next();
214 $this->mutex = false;
217 $this->aggregate->reject($e);
218 $this->mutex = false;
221 $this->aggregate->reject($e);
222 $this->mutex = false;
230 if (Is::settled($this->aggregate)) {
234 unset($this->pending[$idx]);
239 if ($this->advanceIterator() && !$this->checkIfFinished()) {
241 $this->refillPending();
247 if (!$this->pending && !$this->iterable->valid()) {
249 $this->aggregate->resolve(null);