Use getter methods instead of public variables directly

This commit is contained in:
Alex Tselegidis 2022-06-20 12:39:14 +03:00
parent 5027b59150
commit 2ae250c698
2 changed files with 6 additions and 6 deletions

View file

@ -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.');
}

View file

@ -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()
];
}