public function addCall($methodName, array $params = [], callable $onSuccess = null, callable $onError = null)
{
if (!is_string($methodName)) {
throw InvalidArgumentException::expectedParameter(1, 'string', $methodName);
}
$this->calls[$this->index] = compact('methodName', 'params');
$this->handlers[$this->index] = compact('onSuccess', 'onError');
++$this->index;
return $this;
}