Add a callback to be called as part of an answer.

Note that all supplied callbacks will be called in the same invocation.

@param callable ...$callbacks The callbacks.

@return $this This stub.
18288
public function calls(callable ...$callbacks): Stub
    {
        foreach ($callbacks as $callback) {
            $this->callsWith($callback);
        }

        return $this;
    }
76262
protected function createStringCallback($callback, array $parameters)
    {
        if (function_exists($callback)) {
            return $this->createCallableCallback($callback, $parameters);
        } else {
            return $this->createClassesCallback($callback, $parameters);
        }
    }
580643
public function setCallback($callback)
    {
        if (!$callback instanceof Closure) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid parameter for callback: must be %s',
                Closure::class
            ));
        }

        return parent::setCallback($callback);
    }
832862
public function setMethodCalls(array $calls = array())
    {
        $this->calls = array();
        foreach ($calls as $call) {
            $this->addMethodCall($call[0], $call[1]);
        }

        return $this;
    }
1221
public function on($type, $callback)
    {
        if (!isset($this->callbacks[$type])) {
            $this->callbacks[$type] = [];
        }
        $this->callbacks[$type][] = $callback;
        return $this;
    }
660278
public function each($callback)
    {
        array_walk($this->array, function($value, $key) use ($callback) {
            $callback($key, $value);
        });

        return $this;
    }
431933
public function callback($callback)
    {
        $t = $this;
        $args = array_slice(func_get_args(),1);

        // use an event handler to dispatch to the callback
        $this->_events->register('startTransaction', function($event, $connection) use ($t, $callback, $args) {
            $t->results []= call_user_func_array($callback, $args);
        });

        return $this;
    }
217257
public function preprocess(callable $callback)
    {
        if ($callback instanceof Closure) {
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getPreprocessor()->register($callback);
        return $this;
    }
618984
public function setCallback($callback){
		if(!is_callable($callback))
			throw new Exception('Invalid callback passed for logging: '.$callback);
		$this->callback = $callback;
		return $this;
	}
1188185
public function setCallback($callback)
    {
        if (is_array($callback)) {
            require_once 'Zend/Server/Method/Callback.php';
            $callback = new Zend_Server_Method_Callback($callback);
        } elseif (!$callback instanceof Zend_Server_Method_Callback) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception('Invalid method callback provided');
        }
        $this->_callback = $callback;
        return $this;
    }
473766
protected function setCallback($callback) {
		if (!is_callable($callback)) {
			throw new InvalidCallbackException('Invalid callback');
		}

		$this->reflection_parameter =  $this
			     ->getCallbackReflection($callback)
			     ->getParameters()
		;
		$this->callback = $callback;

		return $this;
	}
1318370
public function afterMatch($callback = null)
        {
            if ($callback !== null) {
                if (!is_callable($callback)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            "The after match callback provided is not valid. Given (%s)",
                            gettype($callback)
                        )
                    );
                }

                $this->afterMatchCallback = $callback;

                return $this;
            }

            return $this->afterMatchCallback;
        }
422861
public function setEditableCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableCallback = $callback;

        return $this;
    }
1250514
public function callback(string $name, callable $callback): self
    {
        $this->data->callback($name, $callback);
        return $this;
    }
1046349
public function each(callable $callback): self
    {
        $index = 0;
        foreach ($this->items as $key => $value) {
            $callback($value, $key, $index++);
        }

        return $this;
    }
409412
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            if ($callback($item, $key) === false) {
                break;
            }
        }

        return $this;
    }
147977
public function also(Closure $callback) {
        $predicate = new Predicate(self::ALSO);
        $predicate->bindCallback($callback);

        $this->_params[] = $predicate;

        $this->addBinding(null, $predicate);

        return $this;
    }