librenms/librenms

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

Summary

Maintainability
A
3 hrs
Test Coverage

Method configTemplate has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function configTemplate(): array
    {
        return [
            'config' => [
                [
Severity: Major
Found in LibreNMS/Alert/Transport/Api.php - About 2 hrs to fix

    Method deliverAlert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    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'];
    Severity: Minor
    Found in LibreNMS/Alert/Transport/Api.php - About 1 hr to fix

      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

      <?php

      Possible parse error: class missing opening or closing brace
      Open

      class Api extends Transport

      Possible parse error: class missing opening or closing brace
      Open

      class Api extends Transport

      Closing brace indented incorrectly; expected 4 spaces, found 0
      Open

      }

      Line indented incorrectly; expected 0 spaces, found 4
      Open

          public function deliverAlert(array $alert_data): bool

      Line indented incorrectly; expected 0 spaces, found 4
      Open

          protected string $name = 'API';

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              if ($method !== 'get') {

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              }

      Space before opening parenthesis of function call prohibited
      Open

              $res = match ($method) {

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              if ($username) {

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              }

      Line indented incorrectly; expected 4 spaces, found 12
      Open

                  default => $client->post($host),

      There are no issues that match your filters.

      Category
      Status