summaryrefslogtreecommitdiffstats
path: root/library/Director/RestApi
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:17:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:17:47 +0000
commit5419d4428c86c488a43124f85e5407d7cbae6541 (patch)
tree772c4221a20fd7d1b3e7e67c6e21755a50e80fd7 /library/Director/RestApi
parentAdding upstream version 1.10.2. (diff)
downloadicingaweb2-module-director-upstream.tar.xz
icingaweb2-module-director-upstream.zip
Adding upstream version 1.11.1.upstream/1.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--library/Director/RestApi/RestApiClient.php9
-rw-r--r--library/Director/RestApi/RestApiParams.php3
2 files changed, 6 insertions, 6 deletions
diff --git a/library/Director/RestApi/RestApiClient.php b/library/Director/RestApi/RestApiClient.php
index 2ebc4d4..6dcf93c 100644
--- a/library/Director/RestApi/RestApiClient.php
+++ b/library/Director/RestApi/RestApiClient.php
@@ -8,7 +8,6 @@ use RuntimeException;
class RestApiClient
{
- /** @var resource */
private $curl;
/** @var string HTTP or HTTPS */
@@ -287,7 +286,7 @@ class RestApiClient
if ($statusCode >= 400) {
throw new RuntimeException(
- "Got $statusCode: " . \var_export($res, 1)
+ "Got $statusCode: " . \var_export($res, true)
);
}
@@ -295,14 +294,14 @@ class RestApiClient
}
/**
- * @return resource
+ * @throws RuntimeException
*/
protected function curl()
{
if ($this->curl === null) {
- $this->curl = \curl_init(\sprintf('https://%s:%d', $this->host, $this->port));
+ $this->curl = curl_init(sprintf('https://%s:%d', $this->host, $this->port));
if (! $this->curl) {
- throw new RuntimeException('CURL INIT ERROR: ' . \curl_error($this->curl));
+ throw new RuntimeException('CURL INIT FAILED');
}
}
diff --git a/library/Director/RestApi/RestApiParams.php b/library/Director/RestApi/RestApiParams.php
index c237ac5..741eeed 100644
--- a/library/Director/RestApi/RestApiParams.php
+++ b/library/Director/RestApi/RestApiParams.php
@@ -19,8 +19,9 @@ class RestApiParams
}
$exporter->enableHostServices();
}
+ /** @var ?string $properties */
$properties = $params->shift('properties');
- if ($properties !== null && strlen($properties)) {
+ if ($properties) {
$exporter->filterProperties(preg_split('/\s*,\s*/', $properties, -1, PREG_SPLIT_NO_EMPTY));
}
$exporter->resolveObjects($resolved);