public function createContact($name, $email)
    {
        if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
            throw new Exceptions\InvalidRecipientException('Invalid email address.');
        }

        $data = [
            'name'  => $name,
            'email' => $email
        ];

        return new Contact(
            Connection::sendCurlRequest(Connection::URL_CONTACTS, 'POST', $data, true, $this->apiKey),
            $this->apiKey
        );
    }
public function createContact($name, $email)
    {
        if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
            throw new Exceptions\InvalidRecipientException('Invalid email address.');
        }

        $data = [
            'name'  => $name,
            'email' => $email
        ];

        return new Contact(
            Connection::sendCurlRequest(Connection::URL_CONTACTS, 'POST', $data, true, $this->apiKey),
            $this->apiKey
        );
    }
public function createContact ( $ name , $ email ) { if ( filter_var ( $ email , FILTER_VALIDATE_EMAIL ) === false ) { throw new Exceptions \ InvalidRecipientException ( 'Invalid email address.' ) ; } $ data = [ 'name' => $ name , 'email' => $ email ] ; return new Contact ( Connection :: sendCurlRequest ( Connection :: URL_CONTACTS , 'POST' , $ data , true , $ this -> apiKey ) , $ this -> apiKey ) ; }
Create a new contact.

@param string $name  Name.
@param string $email Email address.

@return Contact The newly created contact.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidRecipientException Thrown if the email address is invalid.
@throws Exceptions\InvalidTokenException
Create a new contact .