/**
* Set the timeout for curl attempts in seconds
* @param int $timeout timeout in seconds, must be > 0
* @param \Bart\Curl $curler curl object to set timeout on
* @throws HttpApiClientException Invalid Timeout in the event that the timeout is non-numeric or non > 0
*/
protected function setTimeout($timeout, $curler)
{
if (is_int($timeout) && $timeout > 0) {
$curler->setPhpCurlOpts(array(CURLOPT_TIMEOUT => $timeout));
} elseif ($timeout !== null) {
throw new HttpApiClientException("Invalid timeout: '{$timeout}'");
}
}