Skip to content

Commit

Permalink
tmp use better name
Browse files Browse the repository at this point in the history
  • Loading branch information
grongor committed Jun 26, 2020
1 parent b125e2a commit 5f1cab3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Transport/CliSnmpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ public function walk(string $oid) : array
private function processOutput(string $output) : array
{
$outputLength = strlen($output);
$i = 0;
$lineStartPos = 0;
$result = [];

while ($i < $outputLength) {
$newLinePos = strpos($output, "\n", $i);
while ($lineStartPos < $outputLength) {
$newLinePos = strpos($output, "\n", $lineStartPos);
assert($newLinePos !== false);

$quotesPos = strpos($output, '"', $i);
$quotesPos = strpos($output, '"', $lineStartPos);
if ($quotesPos === false || $quotesPos > $newLinePos) {
$lineEndPos = $this->getLineEndPos($output, $newLinePos, $i);
$lineEndPos = $this->getLineEndPos($output, $newLinePos, $lineStartPos);

$result = $this->processOutputLine($result, substr($output, $i, $lineEndPos));
$result = $this->processOutputLine($result, substr($output, $lineStartPos, $lineEndPos));

$i = $newLinePos + 1;
$lineStartPos = $newLinePos + 1;

continue;
}
Expand All @@ -150,11 +150,11 @@ private function processOutput(string $output) : array
$newLinePos = strpos($output, "\n", $endQuotesPos);
assert($newLinePos !== false);

$lineEndPos = $this->getLineEndPos($output, $newLinePos, $i);
$lineEndPos = $this->getLineEndPos($output, $newLinePos, $lineStartPos);

$result = $this->processOutputLine($result, substr($output, $i, $lineEndPos));
$result = $this->processOutputLine($result, substr($output, $lineStartPos, $lineEndPos));

$i = $newLinePos + 1;
$lineStartPos = $newLinePos + 1;
}

return $result;
Expand Down

0 comments on commit 5f1cab3

Please sign in to comment.