Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Making omnisendApi protected to let the class being subclassable #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Omnisend.php
Original file line number Diff line number Diff line change
@@ -11,14 +11,14 @@

class Omnisend
{
private $apiKey;
private $apiUrl = 'https://api.omnisend.com/v3/';
private $timeout;
private $numberOfCurlRepeats = 0;
private $verifySSL = true;
private $lastError = array();
private $useCurl = true;
private $version = "1.2";
protected $apiKey;
protected $apiUrl = 'https://api.omnisend.com/v3/';
protected $timeout;
protected $numberOfCurlRepeats = 0;
protected $verifySSL = true;
protected $lastError = array();
protected $useCurl = true;
protected $version = "1.2";

public function __construct($apiKey, $options = array())
{
@@ -191,7 +191,7 @@ public function delete($endpoint, $queryParams = array())
return $this->omnisendApi($endpoint, 'DELETE', '', $queryParams);
}

private function omnisendApi($endpoint, $method = "POST", $fields = array(), $queryParams = array())
protected function omnisendApi($endpoint, $method = "POST", $fields = array(), $queryParams = array())
{
$this->numberOfCurlRepeats++;
$this->lastError = array();
@@ -285,7 +285,7 @@ private function omnisendApi($endpoint, $method = "POST", $fields = array(), $qu
);
} else {
if ($this->numberOfCurlRepeats == 1 && ($status == 408 || $status == 429 || $status == 503)) {
$result = self::omnisendApi($endpoint, $method, $fields, $queryParams);
$result = $this->omnisendApi($endpoint, $method, $fields, $queryParams);
} elseif ($status >= 200 && $status < 300) {
if ($response && !empty($response)) {
return json_decode($response, true);