librenms/librenms

View on GitHub
LibreNMS/Alert/Transport/Victorops.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused local variables such as '$fault'.
Open

        foreach ($alert_data['faults'] as $fault => $data) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Visibility must be declared on property "$protocol"
Open

        $protocol['message_type'] = match ($alert_data['state']) {

Visibility must be declared on property "$res"
Open

        $res = Http::client()->post($url, $protocol);

There must not be more than one property declared per statement
Open

    public function deliverAlert(array $alert_data): bool

There must not be more than one property declared per statement
Open

        $protocol['message_type'] = match ($alert_data['state']) {

There must not be more than one property declared per statement
Open

        $res = Http::client()->post($url, $protocol);

Visibility must be declared on property "$protocol"
Open

        $protocol = [

Possible parse error: non-abstract method defined as abstract
Open

    public function deliverAlert(array $alert_data): bool

There must not be more than one property declared per statement
Open

        $protocol = [

Visibility must be declared on property "$res"
Open

        if ($res->successful()) {

There must not be more than one property declared per statement
Open

        throw new AlertTransportDeliveryException($alert_data, $res->status(), $res->body(), $alert_data['msg'], $protocol);

There must not be more than one property declared per statement
Open

        foreach ($alert_data['faults'] as $fault => $data) {

Visibility must be declared on property "$alert_data"
Open

        foreach ($alert_data['faults'] as $fault => $data) {

Visibility must be declared on property "$alert_data"
Open

        throw new AlertTransportDeliveryException($alert_data, $res->status(), $res->body(), $alert_data['msg'], $protocol);

Space before opening parenthesis of function call prohibited
Open

            default => match ($alert_data['severity']) {

Line indented incorrectly; expected at least 16 spaces, found 12
Open

            $protocol['state_message'] .= $data['string'];

Line indented incorrectly; expected at least 16 spaces, found 12
Open

            return true;

Line indented incorrectly; expected at least 12 spaces, found 8
Open

        return [

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    }

Line indented incorrectly; expected 12 spaces, found 8
Open

        foreach ($alert_data['faults'] as $fault => $data) {

Line indented incorrectly; expected 8 spaces, found 16
Open

                default => 'CRITICAL',

Line indented incorrectly; expected 12 spaces, found 8
Open

        }

Line indented incorrectly; expected at least 8 spaces, found 4
Open

    {

Space before opening parenthesis of function call prohibited
Open

        $protocol['message_type'] = match ($alert_data['state']) {

Line indented incorrectly; expected at least 12 spaces, found 8
Open

        $res = Http::client()->post($url, $protocol);

Line indented incorrectly; expected at least 12 spaces, found 8
Open

        ];

Line indented incorrectly; expected 8 spaces, found 4
Open

    public static function configTemplate(): array

Line indented incorrectly; expected 8 spaces, found 4
Open

    }

Line indented incorrectly; expected 12 spaces, found 8
Open

        }

Line indented incorrectly; expected 12 spaces, found 8
Open

        if ($res->successful()) {

There are no issues that match your filters.

Category
Status