PendingPromise

class Firstred\PostNL\Util\PendingPromise
Promises/A+ implementation that avoids recursion when possible.
Implements

Http\Promise\Promise

Summary

Methods

Methods

public Firstred\PostNL\Util\PendingPromise::__construct($waitFn=null, $cancelFn=null)
Parameters
  • $waitFn (callable) fn that when invoked resolves the promise

  • $cancelFn (callable) fn that when invoked cancels the promise

public Firstred\PostNL\Util\PendingPromise::then($onFulfilled=null, $onRejected=null)
Parameters
  • $onFulfilled (callable | null)

  • $onRejected (callable | null)

Returns

\Firstred\PostNL\Util\PendingPromise | \Http\Promise\Promise

public Firstred\PostNL\Util\PendingPromise::otherwise($onRejected)
Parameters
  • $onRejected (callable)

Returns

\Firstred\PostNL\Util\PendingPromise | \Http\Promise\Promise

public Firstred\PostNL\Util\PendingPromise::wait($unwrap=true)
Parameters
  • $unwrap (bool)

Returns

mixed | void

Throws

\Exception

public Firstred\PostNL\Util\PendingPromise::getState()
Returns

string

public Firstred\PostNL\Util\PendingPromise::cancel()
Returns

void

public Firstred\PostNL\Util\PendingPromise::resolve($value)
Parameters
  • $value (mixed)

public Firstred\PostNL\Util\PendingPromise::reject($reason)
Parameters
  • $reason (mixed)