Skip to content

Commit 44b28d3

Browse files
committed
Apply fixes from StyleCI
1 parent 680948e commit 44b28d3

16 files changed

+55
-48
lines changed

LibreNMS/Enum/ServiceStatus.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* ServiceStatus.php
45
*

LibreNMS/Exceptions/ServiceCheckNotExecutableException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
class ServiceCheckNotExecutableException extends ServiceException
66
{
7-
87
}

LibreNMS/Exceptions/ServiceCheckNotFoundException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
class ServiceCheckNotFoundException extends ServiceException
66
{
7-
87
}

LibreNMS/Exceptions/ServiceException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44

55
class ServiceException extends \Exception
66
{
7-
87
}

LibreNMS/Services/Checks/CheckIcmp.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* CheckIcmp.php
45
*
@@ -33,7 +34,6 @@
3334

3435
class CheckIcmp extends Service
3536
{
36-
3737
public function parameters(): array
3838
{
3939
return [
@@ -53,8 +53,8 @@ public function parameters(): array
5353
new ServiceOption('outgoing-ttl', 'l', ['outgoing-ttl' => 'int|min:0']),
5454
new ServiceOption('timeout', 't'),
5555
new ServiceOption('bytes', 'b'),
56-
new ServiceOption('verbose', 'v', mode: InputOption::VALUE_NONE|InputOption::VALUE_IS_ARRAY),
57-
new ServiceOption('Host', 'H', ['Host' => 'required|ip_or_hostname'], mode: InputOption::VALUE_IS_ARRAY)
56+
new ServiceOption('verbose', 'v', mode: InputOption::VALUE_NONE | InputOption::VALUE_IS_ARRAY),
57+
new ServiceOption('Host', 'H', ['Host' => 'required|ip_or_hostname'], mode: InputOption::VALUE_IS_ARRAY),
5858
];
5959
}
6060

@@ -91,7 +91,7 @@ public function dataSets(string $rrd_filename = '', ?string $ds = null): array
9191
]),
9292
];
9393

94-
return array_filter($dataSets, fn($dataSet) => $ds === null || $ds === $dataSet->name);
94+
return array_filter($dataSets, fn ($dataSet) => $ds === null || $ds === $dataSet->name);
9595
}
9696

9797
public function graph(string $rrd_filename = ''): array
@@ -100,11 +100,11 @@ public function graph(string $rrd_filename = ''): array
100100
'rta' => [
101101
'unit' => 's',
102102
'commands' => [
103-
'DEF:DS0=' . $rrd_filename . ':rta:AVERAGE',
104-
'LINE1.25:DS0#' . LibrenmsConfig::get('graph_colours.mixed.0') . ':' . str_pad(substr('Round Trip Average', 0, 15), 15),
105-
'GPRINT:DS0:LAST:%5.2lf%s',
106-
'GPRINT:DS0:AVERAGE:%5.2lf%s',
107-
'GPRINT:DS0:MAX:%5.2lf%s\\l',
103+
'DEF:DS0=' . $rrd_filename . ':rta:AVERAGE',
104+
'LINE1.25:DS0#' . LibrenmsConfig::get('graph_colours.mixed.0') . ':' . str_pad(substr('Round Trip Average', 0, 15), 15),
105+
'GPRINT:DS0:LAST:%5.2lf%s',
106+
'GPRINT:DS0:AVERAGE:%5.2lf%s',
107+
'GPRINT:DS0:MAX:%5.2lf%s\\l',
108108
],
109109
],
110110
'rtmax' => [
@@ -115,7 +115,7 @@ public function graph(string $rrd_filename = ''): array
115115
'GPRINT:DS1:LAST:%5.2lf%s',
116116
'GPRINT:DS1:AVERAGE:%5.2lf%s',
117117
'GPRINT:DS1:MAX:%5.2lf%s\\l',
118-
]
118+
],
119119
],
120120
'rtmin' => [
121121
'unit' => 's',
@@ -133,7 +133,7 @@ public function graph(string $rrd_filename = ''): array
133133
'GPRINT:DS0:LAST:%5.2lf%s',
134134
'GPRINT:DS0:AVERAGE:%5.2lf%s',
135135
'GPRINT:DS0:MAX:%5.2lf%s\\l',
136-
]
136+
],
137137
];
138138
}
139139
}

LibreNMS/Services/Checks/CheckLoad.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* CheckLoad.php
45
*
@@ -38,29 +39,29 @@ public function parameters(): array
3839
new ServiceOption('warning', 'w', default: '5,5,5'),
3940
new ServiceOption('critical', 'c', default: '10,10,10'),
4041
new ServiceOption('percpu', 'p', ['percpu' => 'int']),
41-
new ServiceOption('procs-to-show', )
42+
new ServiceOption('procs-to-show'),
4243
];
4344
}
4445

4546
public function dataSets(string $rrd_filename = '', ?string $ds = null): array
4647
{
4748
return [
4849
new ServiceDataSet('load', 'processes', [
49-
'DEF:DS0=' . $rrd_filename . ':load1:AVERAGE',
50-
'LINE1.25:DS0#' . LibrenmsConfig::get('graph_colours.mixed.0') . ':' . str_pad(substr('Load 1', 0, 15), 15),
51-
'GPRINT:DS0:LAST:%5.2lf%s',
52-
'GPRINT:DS0:AVERAGE:%5.2lf%s',
53-
'GPRINT:DS0:MAX:%5.2lf%s\\l',
54-
'DEF:DS1=' . $rrd_filename . ':load5:AVERAGE',
55-
'LINE1.25:DS1#' . LibrenmsConfig::get('graph_colours.mixed.1') . ':' . str_pad(substr('Load 5', 0, 15), 15),
56-
'GPRINT:DS1:LAST:%5.2lf%s',
57-
'GPRINT:DS1:AVERAGE:%5.2lf%s',
58-
'GPRINT:DS1:MAX:%5.2lf%s\\l',
59-
'DEF:DS2=' . $rrd_filename . ':load15:AVERAGE',
60-
'LINE1.25:DS2#' . LibrenmsConfig::get('graph_colours.mixed.2') . ':' . str_pad(substr('Load 15', 0, 15), 15),
61-
'GPRINT:DS2:LAST:%5.2lf%s',
62-
'GPRINT:DS2:AVERAGE:%5.2lf%s',
63-
'GPRINT:DS2:MAX:%5.2lf%s\\l',
50+
'DEF:DS0=' . $rrd_filename . ':load1:AVERAGE',
51+
'LINE1.25:DS0#' . LibrenmsConfig::get('graph_colours.mixed.0') . ':' . str_pad(substr('Load 1', 0, 15), 15),
52+
'GPRINT:DS0:LAST:%5.2lf%s',
53+
'GPRINT:DS0:AVERAGE:%5.2lf%s',
54+
'GPRINT:DS0:MAX:%5.2lf%s\\l',
55+
'DEF:DS1=' . $rrd_filename . ':load5:AVERAGE',
56+
'LINE1.25:DS1#' . LibrenmsConfig::get('graph_colours.mixed.1') . ':' . str_pad(substr('Load 5', 0, 15), 15),
57+
'GPRINT:DS1:LAST:%5.2lf%s',
58+
'GPRINT:DS1:AVERAGE:%5.2lf%s',
59+
'GPRINT:DS1:MAX:%5.2lf%s\\l',
60+
'DEF:DS2=' . $rrd_filename . ':load15:AVERAGE',
61+
'LINE1.25:DS2#' . LibrenmsConfig::get('graph_colours.mixed.2') . ':' . str_pad(substr('Load 15', 0, 15), 15),
62+
'GPRINT:DS2:LAST:%5.2lf%s',
63+
'GPRINT:DS2:AVERAGE:%5.2lf%s',
64+
'GPRINT:DS2:MAX:%5.2lf%s\\l',
6465
]),
6566
];
6667
}

LibreNMS/Services/LegacyService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* LegacyService.php
45
*
@@ -68,7 +69,7 @@ public function dataSets(string $rrd_filename = '', array $ds = []): array
6869
$graphs = $vars['check_graph'] ?? [];
6970
foreach ($sets as $name => $unit) {
7071
$commands = $graphs[$name] ?? $this->defaultGraphCommands($rrd_filename, $name);
71-
$dataSets[] = new ServiceDataSet($name, $unit,is_array($commands) ? $commands : [$commands]);
72+
$dataSets[] = new ServiceDataSet($name, $unit, is_array($commands) ? $commands : [$commands]);
7273
}
7374

7475
return $dataSets;

LibreNMS/Services/Service.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Service.php
45
*
@@ -38,12 +39,14 @@ class Service
3839

3940
public function __construct(
4041
public readonly string $type = '',
41-
) {}
42+
) {
43+
}
4244

4345
/**
44-
* @param Device $device
45-
* @param \App\Models\Service $service
46+
* @param Device $device
47+
* @param \App\Models\Service $service
4648
* @return string[]
49+
*
4750
* @throws ServiceException
4851
*/
4952
public function buildCommand(\App\Models\Service $service): array

LibreNMS/Services/ServiceArgument.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Parameter.php
45
*

LibreNMS/Services/ServiceDataSet.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* ServiceDataSet.php
45
*
@@ -31,5 +32,6 @@ public function __construct(
3132
public string $name,
3233
public string $unit,
3334
public array $graphCommands,
34-
) {}
35+
) {
36+
}
3537
}

0 commit comments

Comments
 (0)