Skip to content
This repository was archived by the owner on May 18, 2020. It is now read-only.

Commit ffe797a

Browse files
committed
fix variables usage
1 parent 90898dd commit ffe797a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Wrapper/Mailin.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,30 @@
1111
*/
1212
class Mailin
1313
{
14-
public $parameters;
15-
public $base_url;
16-
public $curl_opts = array();
14+
const ENDPOINT = 'https://api.sendinblue.com/v2.0/';
15+
16+
/** @var string */
17+
private $api_key;
18+
19+
/** @var int */
20+
private $timeout;
1721

1822
public function __construct($parameters)
1923
{
2024
if (!function_exists('curl_init')) {
2125
throw new \RuntimeException('Mailin requires cURL module');
2226
}
23-
$this->config = $parameters;
24-
$this->base_url = 'https://api.sendinblue.com/v2.0';
25-
$this->api_key = $this->config['api_key'];
26-
$this->timeout = $this->config['timeout'];
27+
28+
$this->api_key = $parameters['api_key'];
29+
$this->timeout = $parameters['timeout'];
2730
}
2831

2932
/**
3033
* Do CURL request with authorization.
3134
*/
3235
private function do_request($resource, $method, $input)
3336
{
34-
$called_url = $this->base_url.'/'.$resource;
37+
$called_url = self::ENDPOINT.$resource;
3538
$ch = curl_init($called_url);
3639
$auth_header = 'api-key:'.$this->api_key;
3740
$content_header = 'Content-Type:application/json';
@@ -48,7 +51,6 @@ private function do_request($resource, $method, $input)
4851
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
4952

5053
$data = curl_exec($ch);
51-
$info = curl_getinfo($ch);
5254
if (curl_errno($ch)) {
5355
throw new \RuntimeException('cURL error: '.curl_error($ch));
5456
}

0 commit comments

Comments
 (0)