public function setCredentials ($user, $password, $type = CURLAUTH_ANYSAFE) {
    $this->addCurlOption(CURLOPT_HTTPAUTH, $type);
    $this->addCurlOption(CURLOPT_USERPWD, "{$user}:{$password}");
    return $this;
  }