detain/cisco_parser

View on GitHub

Showing 10 of 18 total issues

File CiscoLoader.php has 599 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Detain\CiscoParser;

/**
Severity: Major
Found in src/CiscoLoader.php - About 1 day to fix

    Method show_int has 181 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function show_int($int)
        {
            $result = [];
            $this->exec('show int '.$int);
            $this->_data = explode("\r\n", $this->_data);
    Severity: Major
    Found in src/CiscoLoader.php - About 7 hrs to fix

      Function show_int has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          public function show_int($int)
          {
              $result = [];
              $this->exec('show int '.$int);
              $this->_data = explode("\r\n", $this->_data);
      Severity: Minor
      Found in src/CiscoLoader.php - About 6 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 parse_cisco_children has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parse_cisco_children($lines, $x = 0, $depth = 0)
          {
              //global $x;
              $data = [];
              $last_command = false;
      Severity: Minor
      Found in src/CiscoParser.php - About 3 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

      CiscoLoader has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CiscoLoader
      {
          /**
           * @var bool
           */
      Severity: Minor
      Found in src/CiscoLoader.php - About 2 hrs to fix

        Method parse_cisco_children has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function parse_cisco_children($lines, $x = 0, $depth = 0)
            {
                //global $x;
                $data = [];
                $last_command = false;
        Severity: Minor
        Found in src/CiscoParser.php - About 1 hr to fix

          Method show_int_status has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function show_int_status()
              {
                  $result = [];
                  $this->exec('show int status');
                  $this->_data = explode("\r\n", $this->_data);
          Severity: Minor
          Found in src/CiscoLoader.php - About 1 hr to fix

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

                public function read($pattern = '', $regex = false)
                {
                    //usleep(1000);
                    $this->_response = '';
                    $match = $pattern;
            Severity: Minor
            Found in src/CiscoLoader.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 arp_table has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function arp_table()
                {
                    $result = [];
                    $this->exec('show arp | exc Incomplete');
                    $this->_data = explode("\r\n", $this->_data);
            Severity: Minor
            Found in src/CiscoLoader.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 configure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function configure($config)
                {
                    // USE AT OWN RISK: This function will apply configuration statements to a device.
                    // Enabled Only
                    if (mb_strpos($this->_prompt, '#') === false) {
            Severity: Minor
            Found in src/CiscoLoader.php - About 25 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

            Severity
            Category
            Status
            Source
            Language