LibreNMS/Alert/Transport/Api.php
Method configTemplate
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function configTemplate(): array
{
return [
'config' => [
[
Method deliverAlert
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function deliverAlert(array $alert_data): bool
{
$request_body = $this->config['api-body'];
$username = $this->config['api-auth-username'];
$password = $this->config['api-auth-password'];
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 36 and the first side effect is on line 32. Open
Open
<?php
- Exclude checks
Possible parse error: class missing opening or closing brace Open
Open
class Api extends Transport
- Exclude checks
Possible parse error: class missing opening or closing brace Open
Open
class Api extends Transport
- Exclude checks
Closing brace indented incorrectly; expected 4 spaces, found 0 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
public function deliverAlert(array $alert_data): bool
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
protected string $name = 'API';
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
if ($method !== 'get') {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
}
- Exclude checks
Space before opening parenthesis of function call prohibited Open
Open
$res = match ($method) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
if ($username) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
Open
default => $client->post($host),
- Exclude checks