DrewM\MailChimp\MailChimp::__construct PHP Method

__construct() public method

Create a new instance
public __construct ( string $api_key )
$api_key string Your MailChimp API key
    public function __construct($api_key)
    {
        $this->api_key = $api_key;
        if (strpos($this->api_key, '-') === false) {
            throw new \Exception("Invalid MailChimp API key `{$api_key}` supplied.");
        }
        list(, $data_center) = explode('-', $this->api_key);
        $this->api_endpoint = str_replace('<dc>', $data_center, $this->api_endpoint);
        $this->last_response = array('headers' => null, 'body' => null);
    }