public function __construct($apiKey, $baseUrl = null)
{
if (strlen($apiKey) < 1) {
throw new \InvalidArgumentException("[{$apiKey}] is not a valid API key");
}
$this->apiKey = $apiKey;
if (isset($baseUrl)) {
$this->baseUrl = $baseUrl;
}
if (!filter_var($this->baseUrl, FILTER_VALIDATE_URL)) {
throw new \InvalidArgumentException("[{$this->baseUrl}] is not a valid URL");
}
}