From 2ae250c6986f0479946e34fe39348452a1ca2ac5 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 20 Jun 2022 12:39:14 +0300 Subject: [PATCH] Use getter methods instead of public variables directly --- application/controllers/Google.php | 4 ++-- application/libraries/Google_sync.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/controllers/Google.php b/application/controllers/Google.php index 066cb902..c75af08f 100644 --- a/application/controllers/Google.php +++ b/application/controllers/Google.php @@ -127,7 +127,7 @@ class Google extends EA_Controller { { $google_event = $CI->google_sync->add_appointment($appointment, $provider, $service, $customer, $settings); - $appointment['id_google_calendar'] = $google_event->id; + $appointment['id_google_calendar'] = $google_event->getId(); $CI->appointments_model->save($appointment); // Save the Google Calendar ID. } @@ -138,7 +138,7 @@ class Google extends EA_Controller { { $google_event = $CI->google_sync->get_event($provider, $appointment['id_google_calendar']); - if ($google_event->status == 'cancelled') + if ($google_event->getStatus() == 'cancelled') { throw new Exception('Event is cancelled, remove the record from Easy!Appointments.'); } diff --git a/application/libraries/Google_sync.php b/application/libraries/Google_sync.php index e9b15c00..d0046773 100644 --- a/application/libraries/Google_sync.php +++ b/application/libraries/Google_sync.php @@ -129,7 +129,7 @@ class Google_sync { public function refresh_token(string $refresh_token) { $this->initialize_clients(); - + $this->client->refreshToken($refresh_token); } @@ -370,7 +370,7 @@ class Google_sync { $calendars = []; - foreach ($calendar_list->items as $google_calendar) + foreach ($calendar_list->getItems() as $google_calendar) { if ($google_calendar->getAccessRole() === 'reader') { @@ -378,8 +378,8 @@ class Google_sync { } $calendars[] = [ - 'id' => $google_calendar->id, - 'summary' => $google_calendar->summary + 'id' => $google_calendar->getId(), + 'summary' => $google_calendar->getSummary() ]; }