From 524c178b1caa989f63dab11c3ff5768487a51c10 Mon Sep 17 00:00:00 2001 From: Andre Rohlf Date: Sun, 14 Feb 2021 18:31:18 +0100 Subject: [PATCH] Update PveClientBase.php Fix simple errors --- src/PveClientBase.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/PveClientBase.php b/src/PveClientBase.php index f6a6a3e..d60c551 100644 --- a/src/PveClientBase.php +++ b/src/PveClientBase.php @@ -262,8 +262,8 @@ private function executeAction($resource, $method, $parameters = []) { }); if ($this->getDebugLevel() >= 1) { - echo "Method: " . method . " , Url: " . $url . "\n"; - if (method != 'GET') { + echo "Method: " . $method . " , Url: " . $url . "\n"; + if ($method != 'GET') { echo "Parameters:\n"; var_dump($params); } @@ -350,12 +350,18 @@ private function executeAction($resource, $method, $parameters = []) { $parameters, $methodType, $this->responseType); - + if ($this->getDebugLevel() >= 2) { - echo $obj . "\n"; - echo "StatusCode: " . $lastResult->getStatusCode() . "\n"; - echo "ReasonPhrase: " . $lastResult->getReasonPhrase() . "\n"; - echo "IsSuccessStatusCode: " . $lastResult->isSuccessStatusCode() . "\n"; + if(is_array($obj)){ + echo '
';
+                print_r($obj);
+                echo '
'; + }else{ + echo $obj . PHP_EOL; + } + echo "StatusCode: " . $lastResult->getStatusCode() . PHP_EOL; + echo "ReasonPhrase: " . $lastResult->getReasonPhrase() . PHP_EOL; + echo "IsSuccessStatusCode: " . $lastResult->isSuccessStatusCode() . PHP_EOL; } if ($this->getDebugLevel() > 0) { @@ -408,7 +414,7 @@ public function waitForTaskToFinish($node, $task, $wait = 500, $timeOut = 10000) * @return bool */ function waitForTaskToFinish1($task, $wait = 500, $timeOut = 10000) { - return waitForTaskToFinish(split(':', $task)[1], $task, $wait, $timeOut); + return waitForTaskToFinish(preg_split(':', $task)[1], $task, $wait, $timeOut); } /**