Skip to content

Commit 7806e31

Browse files
Make PHP 8 compatibility changes + update used endpoints
1 parent 3e97207 commit 7806e31

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/API.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ protected function setCURLOptions(): self {
348348
public function connect(): self {
349349
$this->resource = curl_init();
350350

351-
if ($this->resource == false) {
351+
if (!$this->resource) {
352352
throw new RuntimeException('Unable to initiate cURL session');
353353
}
354354

@@ -371,6 +371,7 @@ public function disconnect(): self {
371371
}
372372

373373
curl_close($this->resource);
374+
$this->resource = null;
374375

375376
return $this;
376377
}

src/CMDBCategory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function create(int $objectID, string $categoryConst, array $attributes):
100100
];
101101

102102
$result = $this->api->request(
103-
'cmdb.category.create',
103+
'cmdb.category.save',
104104
$params
105105
);
106106

@@ -217,7 +217,7 @@ public function update(int $objectID, string $categoryConst, array $attributes,
217217
}
218218

219219
$result = $this->api->request(
220-
'cmdb.category.update',
220+
'cmdb.category.save',
221221
[
222222
'objID' => $objectID,
223223
'category' => $categoryConst,
@@ -382,7 +382,7 @@ public function batchCreate(array $objectIDs, string $categoryConst, array $attr
382382
];
383383

384384
$requests[] = [
385-
'method' => 'cmdb.category.create',
385+
'method' => 'cmdb.category.save',
386386
'params' => $params
387387
];
388388
}
@@ -493,7 +493,7 @@ public function batchUpdate(array $objectIDs, string $categoryConst, array $attr
493493

494494
foreach ($objectIDs as $objectID) {
495495
$requests[] = [
496-
'method' => 'cmdb.category.update',
496+
'method' => 'cmdb.category.save',
497497
'params' => [
498498
'objID' => $objectID,
499499
'category' => $categoryConst,

src/CMDBObject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function create($type, string $title, array $attributes = []): int {
5959
$attributes['title'] = $title;
6060

6161
$result = $this->api->request(
62-
'cmdb.object.create',
62+
'cmdb.object.save',
6363
$attributes
6464
);
6565

@@ -147,7 +147,7 @@ public function update(int $objectID, array $attributes = []): self {
147147
}
148148

149149
$result = $this->api->request(
150-
'cmdb.object.update',
150+
'cmdb.object.save',
151151
$params
152152
);
153153

0 commit comments

Comments
 (0)