From 8409d6a8827a4ed0e79d5ece7e28805d74929e50 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 25 Jan 2026 20:41:05 +0000 Subject: [PATCH] Apply fixes from StyleCI --- LibreNMS/Discovery/Yaml/YamlDiscoveryField.php | 2 ++ LibreNMS/Modules/Processors.php | 2 +- LibreNMS/OS/Boss.php | 1 - LibreNMS/OS/Lcossx.php | 2 +- LibreNMS/OS/Traits/VxworksProcessorUsage.php | 2 +- app/View/SimpleTemplate.php | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php b/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php index 22fc9e66383d..be5825c747af 100644 --- a/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php +++ b/LibreNMS/Discovery/Yaml/YamlDiscoveryField.php @@ -86,6 +86,7 @@ public function getNumericNames(): array if ($this->key === 'value') { // only one oid $prefix = strstr($this->model_column, '_', true) ?: $this->model_column; + return [ 'num_oid', $prefix . '_oid', @@ -102,6 +103,7 @@ private function setValue(mixed $value): void { if (is_callable($this->callback)) { $this->value = call_user_func($this->callback, $value); + return; } diff --git a/LibreNMS/Modules/Processors.php b/LibreNMS/Modules/Processors.php index 28c5ba329fb1..a1e638ef154a 100644 --- a/LibreNMS/Modules/Processors.php +++ b/LibreNMS/Modules/Processors.php @@ -89,7 +89,7 @@ public function poll(OS $os, DataStorageInterface $datastore): void Log::info("$processor->processor_descr: $usage%"); $rrd_name = ['processor', $processor->processor_type, $processor->processor_index]; - $tags = ['processor_type' => $processor->processor_type, 'processor_index' => $processor->processor_index, 'rrd_name' => $rrd_name, 'rrd_def' => $rrd_def]; + $tags = ['processor_type' => $processor->processor_type, 'processor_index' => $processor->processor_index, 'rrd_name' => $rrd_name, 'rrd_def' => $rrd_def]; $fields = ['usage' => $usage]; $datastore->put($os->getDeviceArray(), 'processors', $tags, $fields); diff --git a/LibreNMS/OS/Boss.php b/LibreNMS/OS/Boss.php index 27e7d06e9447..765cc96229bc 100644 --- a/LibreNMS/OS/Boss.php +++ b/LibreNMS/OS/Boss.php @@ -33,7 +33,6 @@ use App\Models\PortVlan; use App\Models\Vlan; use Illuminate\Support\Collection; -use LibreNMS\Device\Processor; use LibreNMS\Interfaces\Discovery\OSDiscovery; use LibreNMS\Interfaces\Discovery\VlanDiscovery; use LibreNMS\Interfaces\Discovery\VlanPortDiscovery; diff --git a/LibreNMS/OS/Lcossx.php b/LibreNMS/OS/Lcossx.php index c69603e0cbcf..fa6844a22925 100644 --- a/LibreNMS/OS/Lcossx.php +++ b/LibreNMS/OS/Lcossx.php @@ -95,7 +95,7 @@ public function pollProcessors(Collection $processors): Collection $cpuList = $this->convertProcessorData($data); foreach ($processors as $processor) { - $key = explode(' ',(string) $processor->processor_descr)[1]; + $key = explode(' ', (string) $processor->processor_descr)[1]; $processor->processor_usage = $cpuList[$key] ?? 0; } diff --git a/LibreNMS/OS/Traits/VxworksProcessorUsage.php b/LibreNMS/OS/Traits/VxworksProcessorUsage.php index 543209999147..ea16593e72b4 100644 --- a/LibreNMS/OS/Traits/VxworksProcessorUsage.php +++ b/LibreNMS/OS/Traits/VxworksProcessorUsage.php @@ -41,7 +41,7 @@ trait VxworksProcessorUsage */ public function discoverProcessors($oid = '.1.3.6.1.4.1.4413.1.1.1.1.4.9.0'): Collection { - $usage = SnmpQuery::get($oid)->value(); + $usage = SnmpQuery::get($oid)->value(); if ($usage) { $usage = $this->parseCpuUsageString($usage); if (is_numeric($usage)) { diff --git a/app/View/SimpleTemplate.php b/app/View/SimpleTemplate.php index 86095d0a2359..e9f2e107c96d 100644 --- a/app/View/SimpleTemplate.php +++ b/app/View/SimpleTemplate.php @@ -269,7 +269,7 @@ private function dateFilter(string $value, array $args): string private function padFilter(string $value, array $args): string { - $direction = match($args[2] ?? 'left') { + $direction = match ($args[2] ?? 'left') { 'right' => STR_PAD_RIGHT, 'both' => STR_PAD_BOTH, default => STR_PAD_LEFT,