From e9cd26454a3b0220477dc52e763b891d93e78401 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 14 Jun 2023 11:18:02 +0000
Subject: [PATCH] Release version 1.0
---
src/UcrmHelper.php | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/UcrmHelper.php b/src/UcrmHelper.php
index aa20501..0c35cdc 100644
--- a/src/UcrmHelper.php
+++ b/src/UcrmHelper.php
@@ -3,9 +3,9 @@
namespace SIPL\UCRM\Holidays;
class UcrmHelper {
- protected $rootDirectory;
- protected $api = NULL;
- protected $config = NULL;
+ protected string $rootDirectory;
+ protected ?\Ubnt\UcrmPluginSdk\Service\UcrmApi $api = NULL;
+ protected ?array $config = NULL;
protected $event = NULL;
function __construct(?string $rootDirectory = NULL) {
@@ -15,18 +15,18 @@
$this->rootDirectory = $rootDirectory;
}
- function getRootDirectory() {
+ function getRootDirectory(): string {
return $this->rootDirectory;
}
- function getApi() {
+ function getApi(): \Ubnt\UcrmPluginSdk\Service\UcrmApi {
if ($this->api === NULL) {
$this->api = \Ubnt\UcrmPluginSdk\Service\UcrmApi::create($this->rootDirectory);
}
return $this->api;
}
- function getConfig() {
+ function getConfig(): array {
if ($this->config === NULL) {
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create($this->rootDirectory);
$this->config = $configManager->loadConfig();
@@ -34,7 +34,7 @@
return $this->config;
}
- function getCurrentEvent() {
+ function getCurrentEvent(): array {
if ($this->event === NULL) {
try {
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
@@ -58,7 +58,7 @@
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');
}
--
Gitblit v1.10.0