Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions library/Netbox/Netbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private function get(string $resource)
if (empty($response->results)) {
throw new \Exception("no results field in response");
}
$results = array_merge($results, $response->results);
array_push($results, ...$response->results);
}
return $results;
}
Expand Down Expand Up @@ -362,12 +362,12 @@ private function makeHelperKeys(array $in) {
}
}

$output = array_merge($output, [(object)$row]);
$output[] = (object)$row;
}
return $output;
}

// This is a function that you can use to add complex rules to define
// This is a function that you can use to add complex rules to define
// host zones based on netbox data, eg: ip range mapping to zone.
// While possible using Import modifiers and Sync rule property filters
// forking this repo and writing your own function reduces the number require in complex setups.
Expand All @@ -390,10 +390,10 @@ private function splitRows(array $in, $key) {
foreach ($row->{$key} as $ip) {
$row->primary_ip_address = $ip;
$row->description = $description . " " . $ip;
$output = array_merge($output, [(object)clone($row)]);
$output[] = (object)clone($row);
}
} else {
$output = array_merge($output, [(object)$row]);
$output[] = (object)$row;
}
}
return $output;
Expand Down Expand Up @@ -465,7 +465,7 @@ private function transform(array $in)
}
}
$this->flattenRecursive($out, '', $in, $this->flattenseparator);
$fnew = array_merge($fnew, [(object)$out]);
$fnew[] = (object)$out;
}
$output = $fnew;
}
Expand All @@ -484,7 +484,7 @@ private function transform(array $in)
}
}
$row->{$mungeheading} = implode("_", $mungevalue);
$mnew = array_merge($mnew, [(object)$row]);
$mnew[] = (object)$row;
}
$output = $mnew;
}
Expand Down