change $organisationIds to $organisationId

This commit is contained in:
Marc Michalsky forumZFD 2020-09-30 15:28:52 +02:00
parent f9cbe9db6c
commit 81bd4bff44
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -16,7 +16,7 @@ class TwingleApiCall {
private $protocol = 'https://'; private $protocol = 'https://';
private $organisationIds; private $organisationId;
/** /**
* TwingleApiCall constructor. * TwingleApiCall constructor.
@ -28,6 +28,7 @@ class TwingleApiCall {
public function __construct($apiKey) { public function __construct($apiKey) {
$this->apiKey = $apiKey; $this->apiKey = $apiKey;
// Get organisation id
$curl = curl_init($this->protocol . 'organisation' . $this->baseUrl); $curl = curl_init($this->protocol . 'organisation' . $this->baseUrl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, [ curl_setopt($curl, CURLOPT_HTTPHEADER, [
@ -42,7 +43,7 @@ class TwingleApiCall {
throw new \API_Exception("Twingle API call failed"); throw new \API_Exception("Twingle API call failed");
} }
$this->organisationIds = array_column($response, 'id'); $this->organisationId = array_column($response, 'id');
} }
/** /**
@ -57,7 +58,7 @@ class TwingleApiCall {
*/ */
public function getProject($projectId = NULL) { public function getProject($projectId = NULL) {
$response = []; $response = [];
foreach ($this->organisationIds as $organisationId) { foreach ($this->organisationId as $organisationId) {
$url = empty($projectId) $url = empty($projectId)
? $this->protocol . 'project' . $this->baseUrl . 'by-organisation/' . $organisationId ? $this->protocol . 'project' . $this->baseUrl . 'by-organisation/' . $organisationId
: $this->protocol . 'project' . $this->baseUrl . $projectId; : $this->protocol . 'project' . $this->baseUrl . $projectId;
@ -146,8 +147,8 @@ class TwingleApiCall {
/** /**
* @return array * @return array
*/ */
public function getOrganisationIds() { public function getOrganisationId() {
return $this->organisationIds; return $this->organisationId;
} }
/** /**