EvilFreelancer/routeros-api-php

View on GitHub
src/Client.php

Summary

Maintainability
C
1 day
Test Coverage

File Client.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace RouterOS;

use DivineOmega\SSHConnection\SSHConnection;
Severity: Minor
Found in src/Client.php - About 2 hrs to fix

    Function readRAW has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public function readRAW(array $options = [])
        {
            // By default response is empty
            $response = [];
            // We have to wait a !done or !fatal
    Severity: Minor
    Found in src/Client.php - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function parseResponse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parseResponse(array $response): array
        {
            $result = [];
            $i      = -1;
            $lines  = count($response);
    Severity: Minor
    Found in src/Client.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method readRAW has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function readRAW(array $options = [])
        {
            // By default response is empty
            $response = [];
            // We have to wait a !done or !fatal
    Severity: Minor
    Found in src/Client.php - About 1 hr to fix

      Function query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function query($endpoint, array $where = null, string $operations = null, string $tag = null): ClientInterface
          {
              // If endpoint is string then build Query object
              $query = ($endpoint instanceof Query)
                  ? $endpoint
      Severity: Minor
      Found in src/Client.php - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function rosario has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function rosario(array $raw): array
          {
              // This RAW should't be an error
              $positions = array_keys($raw, '!re');
              $count     = count($raw);
      Severity: Minor
      Found in src/Client.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function connect(): bool
          {
              // By default we not connected
              $connected = false;
      
      
      Severity: Minor
      Found in src/Client.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function export has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function export(string $arguments = null): string
          {
              // Set params
              $sshHost       = $this->config('host');
              $sshPort       = $this->config('ssh_port');
      Severity: Minor
      Found in src/Client.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      There are no issues that match your filters.

      Category
      Status