diff --git a/LibreNMS/Data/Graphing/AbstractGraph.php b/LibreNMS/Data/Graphing/AbstractGraph.php index e4a9fe9f24..1b0392d9e4 100644 --- a/LibreNMS/Data/Graphing/AbstractGraph.php +++ b/LibreNMS/Data/Graphing/AbstractGraph.php @@ -1,4 +1,5 @@ unitText = $unitText; + return $this; } public function units(string $units): self { $this->units = $units; + return $this; } public function totalUnits(string $totalUnits): self { $this->totalUnits = $totalUnits; + return $this; } public function colours(string $colours): self { $this->colours = $colours; + return $this; } public function scaleMin(float $scaleMin): self { $this->scaleMin = $scaleMin; + return $this; } public function scaleMax(float $scaleMax): self { $this->scaleMax = $scaleMax; + return $this; } public function noTotal(bool $noTotal = true): self { $this->nototal = $noTotal; + return $this; } public function descrLen(int $descrLen): self { $this->descrLen = $descrLen; + return $this; } @@ -108,6 +117,7 @@ public function addDataset( 'areacolour' => $areaColour, 'invert' => $invert, ]; + return $this; } diff --git a/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php b/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php index fa088eac26..f7edb4b9d5 100644 --- a/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php +++ b/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php @@ -1,4 +1,5 @@ unitText = $unitText; + return $this; } public function units(string $units): self { $this->units = $units; + return $this; } public function totalUnits(string $totalUnits): self { $this->totalUnits = $totalUnits; + return $this; } public function colours(string $colours): self { $this->colours = $colours; + return $this; } public function scaleMin(float $scaleMin): self { $this->scaleMin = $scaleMin; + return $this; } public function scaleMax(float $scaleMax): self { $this->scaleMax = $scaleMax; + return $this; } public function divider(float $divider): self { $this->divider = $divider; + return $this; } public function multiplier(float $multiplier): self { $this->multiplier = $multiplier; + return $this; } public function textOrig(bool $textOrig = true): self { $this->textOrig = $textOrig; + return $this; } public function noTotal(bool $noTotal = true): self { $this->nototal = $noTotal; + return $this; } public function descrLen(int $descrLen): self { $this->descrLen = $descrLen; + return $this; } @@ -123,6 +135,7 @@ public function addDataset( 'descr' => $description, 'colour' => $colour, ]; + return $this; } diff --git a/LibreNMS/Data/Graphing/Device/ProcessorGraph.php b/LibreNMS/Data/Graphing/Device/ProcessorGraph.php index dc3754d180..634a90a442 100644 --- a/LibreNMS/Data/Graphing/Device/ProcessorGraph.php +++ b/LibreNMS/Data/Graphing/Device/ProcessorGraph.php @@ -1,4 +1,5 @@ processors as $proc) { $files[] = Rrd::name($this->device->hostname, ['processor', $proc->processor_type, $proc->processor_index]); } + return $files; } diff --git a/LibreNMS/Data/Graphing/GraphFactory.php b/LibreNMS/Data/Graphing/GraphFactory.php index bab8ad240b..0e9a7f99a2 100644 --- a/LibreNMS/Data/Graphing/GraphFactory.php +++ b/LibreNMS/Data/Graphing/GraphFactory.php @@ -1,4 +1,5 @@ $vars]); } diff --git a/LibreNMS/Data/Graphing/LegacyGraph.php b/LibreNMS/Data/Graphing/LegacyGraph.php index cee665eaae..8487ee5e5a 100644 --- a/LibreNMS/Data/Graphing/LegacyGraph.php +++ b/LibreNMS/Data/Graphing/LegacyGraph.php @@ -1,4 +1,5 @@ loaded = true; + return; } @@ -145,19 +148,21 @@ private function load(array $vars = []): void public function authorize(): bool { $this->load(); + return $this->authorized; } - public function definition(GraphParameters $graph_params): array { $this->load($graph_params->all()); + return $this->rrdOptions; } public function getPageTitle(): string { $this->load(); + return $this->pageTitle ?? $this->getGraphTitle(); } @@ -179,6 +184,7 @@ public function getGraphTitle(): string public function getRrdFiles(): array { $this->load(); + return $this->rrdFiles; } } diff --git a/LibreNMS/Exceptions/InvalidGraph.php b/LibreNMS/Exceptions/InvalidGraph.php index 6bb3ff163f..99bde5b542 100644 --- a/LibreNMS/Exceptions/InvalidGraph.php +++ b/LibreNMS/Exceptions/InvalidGraph.php @@ -1,4 +1,5 @@ line("Type: $graph->type"); $this->line("Subtype: $graph->subtype"); $this->line('Authorized: ' . ($graph->authorize() ? 'true' : 'false')); - $this->line("Graph Title: " . $graph->getGraphTitle()); - $this->line("Page Title: " . substr($graph->getPageTitle(), 0, 80)); - $this->line("Rrd Files: " . implode(', ', array_map(fn($f) => basename($f), $graph->getRrdFiles()))); - $this->line("Definition: " . substr(implode(' ', $graph->definition()), 80)); - + $this->line('Graph Title: ' . $graph->getGraphTitle()); + $this->line('Page Title: ' . substr($graph->getPageTitle(), 0, 80)); + $this->line('Rrd Files: ' . implode(', ', array_map(fn ($f) => basename($f), $graph->getRrdFiles()))); + $this->line('Definition: ' . substr(implode(' ', $graph->definition()), 80)); return 0; }