Lines Matching refs:this

27         $this->waitFn = $waitFn;
28 $this->cancelFn = $cancelFn;
35 if ($this->state === self::PENDING) {
36 $p = new Promise(null, [$this, 'cancel']);
37 $this->handlers[] = [$p, $onFulfilled, $onRejected];
38 $p->waitList = $this->waitList;
39 $p->waitList[] = $this;
44 if ($this->state === self::FULFILLED) {
45 $promise = Create::promiseFor($this->result);
51 $rejection = Create::rejectionFor($this->result);
57 return $this->then(null, $onRejected);
62 $this->waitIfPending();
64 if ($this->result instanceof PromiseInterface) {
65 return $this->result->wait($unwrap);
68 if ($this->state === self::FULFILLED) {
69 return $this->result;
72 throw Create::exceptionFor($this->result);
78 return $this->state;
83 if ($this->state !== self::PENDING) {
87 $this->waitFn = $this->waitList = null;
89 if ($this->cancelFn) {
90 $fn = $this->cancelFn;
91 $this->cancelFn = null;
95 $this->reject($e);
97 $this->reject($e);
103 if ($this->state === self::PENDING) {
104 $this->reject(new CancellationException('Promise has been cancelled'));
110 $this->settle(self::FULFILLED, $value);
115 $this->settle(self::REJECTED, $reason);
120 if ($this->state !== self::PENDING) {
122 if ($state === $this->state && $value === $this->result) {
125 throw $this->state === $state
127 : new \LogicException("Cannot change a {$this->state} promise to {$state}");
130 if ($value === $this) {
135 $this->state = $state;
136 $this->result = $value;
137 $handlers = $this->handlers;
138 $this->handlers = null;
139 $this->waitList = $this->waitFn = null;
140 $this->cancelFn = null;
221 if ($this->state !== self::PENDING) {
223 } elseif ($this->waitFn) {
224 $this->invokeWaitFn();
225 } elseif ($this->waitList) {
226 $this->invokeWaitList();
229 $this->reject('Cannot wait on a promise that has '
238 if ($this->state === self::PENDING) {
239 $this->reject('Invoking the wait callback did not resolve the promise');
246 $wfn = $this->waitFn;
247 $this->waitFn = null;
250 if ($this->state === self::PENDING) {
253 $this->reject($reason);
264 $waitList = $this->waitList;
265 $this->waitList = null;