You are here

public function CallbackPromise::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php \Prophecy\Promise\CallbackPromise::__construct()

Initializes callback promise.

Parameters

callable $callback Custom callback:

Throws

\Prophecy\Exception\InvalidArgumentException

File

vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php, line 35

Class

CallbackPromise
Callback promise.

Namespace

Prophecy\Promise

Code

public function __construct($callback) {
  if (!is_callable($callback)) {
    throw new InvalidArgumentException(sprintf('Callable expected as an argument to CallbackPromise, but got %s.', gettype($callback)));
  }
  $this->callback = $callback;
}