From 14d3eeddc827c7d822ecbc7b371b13cb3e9ac108 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 14 Jun 2023 10:56:01 +0000
Subject: [PATCH] Fixes for UCRM 4.0
---
src/UcrmHelper.php | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/UcrmHelper.php b/src/UcrmHelper.php
index ced5aac..bc14978 100644
--- a/src/UcrmHelper.php
+++ b/src/UcrmHelper.php
@@ -50,6 +50,11 @@
return $this->config;
}
+ function getVersion() {
+ $response = $this->getApi()->get('/version');
+ return $response['version'];
+ }
+
function getCurrentEvent() {
if ($this->event === NULL) {
try {
@@ -74,17 +79,17 @@
throw new \RuntimeException('Failed to process event - event not found');
}
- if (!is_int($event['entityId'])) {
+ if (!ctype_digit($event['entityId'])) {
throw new \RuntimeException('Failed to process event - invalid entity ID');
}
- $this->event = $data;
- } catch (\Exception $e) {
+ $this->event = $event;
+ } catch (\Throwable $e) {
$this->event = $e;
}
}
- if ($this->event instanceof \Exception) {
+ if ($this->event instanceof \Throwable) {
throw $this->event;
}
--
Gitblit v1.10.0