Skip to content

Commit

Permalink
Add check for PHP CURL extension availability
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantist committed Nov 11, 2016
1 parent 04d7eac commit ccc6e61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ class API
* @param string $api_key API Key of your application.
* You can get your API Key on https://convertio.co/api/
*
* @throws \Convertio\Exceptions\APIException if api key is missing or empty
* @throws \Convertio\Exceptions\APIException if api key is missing/empty or CURL extension is not installed
*/
public function __construct($api_key)
{
if (empty($api_key)) {
throw new APIException("API Key parameter is empty");
}

if (!function_exists('curl_version')) {
throw new APIException("This API Wrapper requires PHP CURL extension to be enabled (http://php.net/curl)");
}

$this->api_key = $api_key;
}

Expand Down

0 comments on commit ccc6e61

Please sign in to comment.