Skip to content

Commit 071ca9b

Browse files
Apply fixes from StyleCI (librenms#15698)
Co-authored-by: StyleCI Bot <[email protected]>
1 parent 58becd9 commit 071ca9b

File tree

615 files changed

+4562
-4554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

615 files changed

+4562
-4554
lines changed

LibreNMS/Alert/AlertRules.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function runRules($device_id)
121121
$details = gzcompress(json_encode($details), 9);
122122
dbUpdate(['details' => $details], 'alert_log', 'id = ?', [$alert_log['id']]);
123123
} else {
124-
$extra = gzcompress(json_encode(['contacts' => AlertUtil::getContacts($qry), 'rule'=>$qry]), 9);
124+
$extra = gzcompress(json_encode(['contacts' => AlertUtil::getContacts($qry), 'rule' => $qry]), 9);
125125
if (dbInsert(['state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'details' => $extra], 'alert_log')) {
126126
if (is_null($current_state)) {
127127
dbInsert(['state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1, 'alerted' => 0], 'alerts');

LibreNMS/Alert/Transport.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ protected function parseUserOptions(string $input, array $replacements = []): ar
8787
public static function getColorForState($state)
8888
{
8989
$colors = [
90-
AlertState::CLEAR => Config::get('alert_colour.ok'),
91-
AlertState::ACTIVE => Config::get('alert_colour.bad'),
90+
AlertState::CLEAR => Config::get('alert_colour.ok'),
91+
AlertState::ACTIVE => Config::get('alert_colour.bad'),
9292
AlertState::ACKNOWLEDGED => Config::get('alert_colour.acknowledged'),
93-
AlertState::WORSE => Config::get('alert_colour.worse'),
94-
AlertState::BETTER => Config::get('alert_colour.better'),
93+
AlertState::WORSE => Config::get('alert_colour.worse'),
94+
AlertState::BETTER => Config::get('alert_colour.better'),
9595
];
9696

9797
return isset($colors[$state]) ? $colors[$state] : '#337AB7';

LibreNMS/Alert/Transport/Clickatell.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ public static function configTemplate(): array
5353
'config' => [
5454
[
5555
'title' => 'Token',
56-
'name' => 'clickatell-token',
56+
'name' => 'clickatell-token',
5757
'descr' => 'Clickatell Token',
58-
'type' => 'password',
58+
'type' => 'password',
5959
],
6060
[
6161
'title' => 'Mobile Numbers',
62-
'name' => 'clickatell-numbers',
62+
'name' => 'clickatell-numbers',
6363
'descr' => 'Enter mobile numbers, can be new line or comma separated',
64-
'type' => 'textarea',
64+
'type' => 'textarea',
6565
],
6666
],
6767
'validation' => [
68-
'clickatell-token' => 'required|string',
68+
'clickatell-token' => 'required|string',
6969
'clickatell-numbers' => 'required|string',
7070
],
7171
];

LibreNMS/Alert/Transport/Gitlab.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function configTemplate(): array
7272
'title' => 'Project ID',
7373
'name' => 'gitlab-id',
7474
'descr' => 'GitLab Project ID',
75-
'type'=> 'text',
75+
'type' => 'text',
7676
],
7777
[
7878
'title' => 'Personal Access Token',

LibreNMS/Alert/Transport/Hue.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ public function deliverAlert(array $alert_data): bool
6262
public static function configTemplate(): array
6363
{
6464
return [
65-
'config'=>[
65+
'config' => [
6666
[
67-
'title'=> 'Host',
67+
'title' => 'Host',
6868
'name' => 'hue-host',
6969
'descr' => 'Hue Host',
7070
'type' => 'text',
7171
],
7272
[
73-
'title'=> 'Hue User',
73+
'title' => 'Hue User',
7474
'name' => 'hue-user',
7575
'descr' => 'Phillips Hue Host',
7676
'type' => 'text',
7777
],
7878
[
79-
'title'=> 'Duration',
79+
'title' => 'Duration',
8080
'name' => 'hue-duration',
8181
'descr' => 'Phillips Hue Duration',
8282
'type' => 'select',

LibreNMS/Alert/Transport/Irc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function configTemplate(): array
6262
'title' => 'IRC',
6363
'name' => 'irc',
6464
'descr' => 'Enable IRC alerts',
65-
'type' => 'checkbox',
65+
'type' => 'checkbox',
6666
'default' => true,
6767
],
6868
],

LibreNMS/Alert/Transport/Mail.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static function configTemplate(): array
6161
'title' => 'Contact Type',
6262
'name' => 'mail-contact',
6363
'descr' => 'Method for selecting contacts',
64-
'type' => 'select',
64+
'type' => 'select',
6565
'options' => [
6666
'Specified Email' => 'email',
6767
'Device sysContact' => 'sysContact',
@@ -74,13 +74,13 @@ public static function configTemplate(): array
7474
'title' => 'Email',
7575
'name' => 'email',
7676
'descr' => 'Email address of contact',
77-
'type' => 'text',
77+
'type' => 'text',
7878
],
7979
[
8080
'title' => 'Role',
8181
'name' => 'role',
8282
'descr' => 'Role of users to mail',
83-
'type' => 'select',
83+
'type' => 'select',
8484
'options' => $roles,
8585
],
8686
[

LibreNMS/Alert/Transport/Pagerduty.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public function deliverAlert(array $alert_data): bool
4343
$safe_message = strip_tags($alert_data['msg']) ?: 'Test';
4444
$message = array_filter(explode("\n", $safe_message), 'strlen');
4545
$data = [
46-
'routing_key' => $this->config['service_key'],
46+
'routing_key' => $this->config['service_key'],
4747
'event_action' => $event_action,
48-
'dedup_key' => (string) $alert_data['alert_id'],
49-
'payload' => [
50-
'custom_details' => ['message' => $message],
51-
'group' => (string) \DeviceCache::get($alert_data['device_id'])->groups->pluck('name'),
52-
'source' => $alert_data['hostname'],
48+
'dedup_key' => (string) $alert_data['alert_id'],
49+
'payload' => [
50+
'custom_details' => ['message' => $message],
51+
'group' => (string) \DeviceCache::get($alert_data['device_id'])->groups->pluck('name'),
52+
'source' => $alert_data['hostname'],
5353
'severity' => $alert_data['severity'],
54-
'summary' => ($alert_data['name'] ? $alert_data['name'] . ' on ' . $alert_data['hostname'] : $alert_data['title']),
54+
'summary' => ($alert_data['name'] ? $alert_data['name'] . ' on ' . $alert_data['hostname'] : $alert_data['title']),
5555
],
5656
];
5757

@@ -88,8 +88,8 @@ public static function configTemplate(): array
8888
],
8989
[
9090
'title' => 'Routing Key',
91-
'type' => 'text',
92-
'name' => 'service_key',
91+
'type' => 'text',
92+
'name' => 'service_key',
9393
],
9494
[
9595
'title' => 'Custom API URL',

LibreNMS/Alert/Transport/Playsms.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ public static function configTemplate(): array
9393
],
9494
],
9595
'validation' => [
96-
'playsms-url' => 'required|url',
97-
'playsms-user' => 'required|string',
98-
'playsms-token' => 'required|string',
96+
'playsms-url' => 'required|url',
97+
'playsms-user' => 'required|string',
98+
'playsms-token' => 'required|string',
9999
'playsms-mobiles' => 'required',
100100
],
101101
];

LibreNMS/Alert/Transport/Pushover.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ public static function configTemplate(): array
9797
'config' => [
9898
[
9999
'title' => 'Api Key',
100-
'name' => 'appkey',
100+
'name' => 'appkey',
101101
'descr' => 'Api Key',
102-
'type' => 'password',
102+
'type' => 'password',
103103
],
104104
[
105105
'title' => 'User Key',
106-
'name' => 'userkey',
106+
'name' => 'userkey',
107107
'descr' => 'User Key',
108-
'type' => 'password',
108+
'type' => 'password',
109109
],
110110
[
111111
'title' => 'Pushover Options',
112-
'name' => 'options',
112+
'name' => 'options',
113113
'descr' => 'Pushover options',
114-
'type' => 'textarea',
114+
'type' => 'textarea',
115115
],
116116
],
117117
'validation' => [

LibreNMS/Alert/Transport/Smseagle.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ public static function configTemplate(): array
9696
],
9797
],
9898
'validation' => [
99-
'smseagle-url' => 'required|url',
100-
'smseagle-token' => 'required_without:smseagle-user,smseagle-pass|string',
101-
'smseagle-user' => 'required_without:smseagle-token|string',
102-
'smseagle-pass' => 'required_without:smseagle-token|string',
99+
'smseagle-url' => 'required|url',
100+
'smseagle-token' => 'required_without:smseagle-user,smseagle-pass|string',
101+
'smseagle-user' => 'required_without:smseagle-token|string',
102+
'smseagle-pass' => 'required_without:smseagle-token|string',
103103
'smseagle-mobiles' => 'required',
104104
],
105105
];

LibreNMS/Alert/Transport/Smsfeedback.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public static function configTemplate(): array
8181
],
8282
],
8383
'validation' => [
84-
'smsfeedback-user' => 'required|string',
85-
'smsfeedback-pass' => 'required|string',
84+
'smsfeedback-user' => 'required|string',
85+
'smsfeedback-pass' => 'required|string',
8686
'smsfeedback-mobiles' => 'required',
87-
'smsfeedback-sender' => 'required|string',
87+
'smsfeedback-sender' => 'required|string',
8888
],
8989
];
9090
}

LibreNMS/Alert/Transport/Twilio.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public static function configTemplate(): array
7272
],
7373
],
7474
'validation' => [
75-
'twilio-sid' => 'required|string',
76-
'twilio-token' => 'required|string',
75+
'twilio-sid' => 'required|string',
76+
'twilio-token' => 'required|string',
7777
'twilio-to' => 'required',
7878
'twilio-sender' => 'required',
7979
],

LibreNMS/Alert/Transport/Ukfastpss.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function configTemplate(): array
9595
'title' => 'Secure',
9696
'name' => 'secure',
9797
'descr' => 'Specifies whether created request should be secure',
98-
'type' => 'checkbox',
98+
'type' => 'checkbox',
9999
'default' => true,
100100
],
101101
],

LibreNMS/Authentication/LdapAuthorizationAuthorizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ public function getUser($user_id)
207207
return [
208208
'username' => $username,
209209
'realname' => $realname,
210-
'user_id' => $user_id,
211-
'email' => $email,
210+
'user_id' => $user_id,
211+
'email' => $email,
212212
];
213213
}
214214
}

LibreNMS/Authentication/SSOAuthorizer.php

+2
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ public function authSSOProxyTrusted()
138138
}
139139
}
140140
}
141+
141142
// No match, proxy is untrusted
142143
return false;
143144
} catch (InvalidIpException $e) {
144145
// Webserver is talking nonsense (or, IPv10 has been deployed, or maybe something weird like a domain socket is in use?)
145146
return false;
146147
}
147148
}
149+
148150
// Not enabled, trust everything
149151
return true;
150152
}

LibreNMS/Exceptions/ApiException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct($message = '', $code = 400, $previous = null)
4747
public function render($request): JsonResponse
4848
{
4949
return response()->json([
50-
'status' => 'error',
50+
'status' => 'error',
5151
'message' => $this->getMessage(),
5252
], $this->getCode(), [], JSON_PRETTY_PRINT);
5353
}

LibreNMS/IRCBot.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ private function connect($try = 0)
554554
}
555555

556556
if ($this->ssl && $this->config['irc_disable_ssl_check']) {
557-
$ssl_context_params = ['ssl'=>['allow_self_signed'=> true, 'verify_peer' => false, 'verify_peer_name' => false]];
557+
$ssl_context_params = ['ssl' => ['allow_self_signed' => true, 'verify_peer' => false, 'verify_peer_name' => false]];
558558
$ssl_context = stream_context_create($ssl_context_params);
559559
$this->socket['irc'] = stream_socket_client($server . ':' . $this->port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ssl_context);
560560
} else {
@@ -1058,21 +1058,21 @@ private function _html2irc($string)
10581058
$string = preg_replace('#</u>#i', chr(31), $string);
10591059

10601060
$colors = [
1061-
'white' => '00',
1062-
'black' => '01',
1063-
'blue' => '02',
1064-
'green' => '03',
1065-
'red' => '04',
1066-
'brown' => '05',
1067-
'purple' => '06',
1068-
'orange' => '07',
1069-
'yellow' => '08',
1061+
'white' => '00',
1062+
'black' => '01',
1063+
'blue' => '02',
1064+
'green' => '03',
1065+
'red' => '04',
1066+
'brown' => '05',
1067+
'purple' => '06',
1068+
'orange' => '07',
1069+
'yellow' => '08',
10701070
'lightgreen' => '09',
1071-
'cyan' => '10',
1071+
'cyan' => '10',
10721072
'lightcyan' => '11',
10731073
'lightblue' => '12',
1074-
'pink' => '13',
1075-
'grey' => '14',
1074+
'pink' => '13',
1075+
'grey' => '14',
10761076
'lightgrey' => '15',
10771077
];
10781078

LibreNMS/Modules/Isis.php

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public function pollIsIsMib(Collection $adjacencies, OS $os): Collection
173173

174174
if (count($data) !== $adjacencies->where('isisISAdjState', 'up')->count()) {
175175
echo 'New Adjacencies, running discovery';
176+
176177
// don't enable, might be a bad heuristic
177178
return $this->fillNew($adjacencies, $this->discoverIsIsMib($os));
178179
}

LibreNMS/Modules/PrinterSupplies.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ public function poll(OS $os, DataStorageInterface $datastore): void
101101
echo $tonerperc . " %\n";
102102

103103
$tags = [
104-
'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000),
105-
'rrd_name' => ['toner', $toner['supply_type'], $toner['supply_index']],
104+
'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000),
105+
'rrd_name' => ['toner', $toner['supply_type'], $toner['supply_index']],
106106
'rrd_oldname' => ['toner', $toner['supply_descr']],
107-
'index' => $toner['supply_index'],
107+
'index' => $toner['supply_index'],
108108
];
109109
$datastore->put($device, 'toner', $tags, $tonerperc);
110110

LibreNMS/OS/Allied.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ public function discoverOS(Device $device): void
8181
$hardware = $c;
8282
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
8383

84-
// sysDescr.0 = STRING: "CentreCOM 9924Ts, version 3.2.1-04, built 08-Sep-2009"
84+
// sysDescr.0 = STRING: "CentreCOM 9924Ts, version 3.2.1-04, built 08-Sep-2009"
8585
} elseif ($a == 'CentreCOM' && $c == 'version') {
8686
$version = $d;
8787
$features = $f;
8888
$hardware = snmp_get($this->getDeviceArray(), 'arBoardName.1', '-OsvQU', 'AT-INTERFACES-MIB');
8989
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
9090

91-
//AT-GS950/24 Gigabit Ethernet WebSmart Switch
92-
//Also requires system description as no OIDs provide $hardware
91+
//AT-GS950/24 Gigabit Ethernet WebSmart Switch
92+
//Also requires system description as no OIDs provide $hardware
9393
} elseif ($d == 'WebSmart' && $e == 'Switch') {
9494
$version = snmp_get($this->getDeviceArray(), 'swhub.167.81.1.3.0', '-OsvQU', 'AtiL2-MIB');
9595
$version = $d . ' ' . $version;

LibreNMS/OS/Ciscowlc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function pollOS(DataStorageInterface $datastore): void
6161
->addDataset('NUMCLIENTS', 'GAUGE', 0, 12500000000);
6262

6363
$fields = [
64-
'NUMAPS' => $numAccessPoints,
64+
'NUMAPS' => $numAccessPoints,
6565
'NUMCLIENTS' => $numClients,
6666
];
6767

LibreNMS/OS/Comware.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function discoverMempools()
9797
$mempools->push((new Mempool([
9898
'mempool_index' => $index,
9999
'mempool_type' => 'comware',
100-
'mempool_class' =>'system',
100+
'mempool_class' => 'system',
101101
'mempool_descr' => $entity_name[$index],
102102
'mempool_precision' => 1,
103103
'mempool_perc_oid' => ".1.3.6.1.4.1.25506.2.6.1.1.1.1.8.$index",

LibreNMS/OS/Riverbed.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public function pollOS(DataStorageInterface $datastore): void
6868
->addDataset('total', 'GAUGE', 0);
6969

7070
$fields = [
71-
'half_open' => $conn_half_open,
71+
'half_open' => $conn_half_open,
7272
'half_closed' => $conn_half_closed,
7373
'established' => $conn_established,
74-
'active' => $conn_active,
75-
'total' => $conn_total,
74+
'active' => $conn_active,
75+
'total' => $conn_total,
7676
];
7777

7878
$tags = compact('rrd_def');

0 commit comments

Comments
 (0)