From 0c6a58a8c94bc99a19c036081fe42733f13f0830 Mon Sep 17 00:00:00 2001 From: Max Bachhuber Date: Wed, 10 May 2017 11:10:53 +0200 Subject: [PATCH] Add option to disable SSL Peer verification to Client. --- src/Client.php | 26 +++++++++++++++++++++++++- src/ClientInterface.php | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index ab89f71..6771067 100644 --- a/src/Client.php +++ b/src/Client.php @@ -115,7 +115,7 @@ public function getApiVersion() public function &getConnector() { if (empty($this->connector)) { - $this->connector = new Connector(); + $this->connector = (new Connector())->setSslVerifyPeer($this->getSslVerifyPeer()); } return $this->connector; @@ -226,4 +226,28 @@ private function prepareAttachments($attachments = null) return $file_params; } + + + /** + * @var bool + */ + private $ssl_verify_peer = true; + + /** + * {@inheritdoc} + */ + public function getSslVerifyPeer() + { + return $this->ssl_verify_peer; + } + + /** + * {@inheritdoc} + */ + public function &setSslVerifyPeer($value) + { + $this->ssl_verify_peer = (bool) $value; + + return $this; + } } diff --git a/src/ClientInterface.php b/src/ClientInterface.php index d1fdcf6..d144147 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -11,7 +11,7 @@ /** * @package ActiveCollab\SDK */ -interface ClientInterface +interface ClientInterface extends VerifySslPeerInterface { const VERSION = '3.0.0';