vanderlee/Comprehend

View on GitHub

Showing 10 of 10 total issues

Method __construct has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($overwrites = [])
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $abnf = new Rfc2234();

Severity: Major
Found in src/Library/Rfc3986.php - About 3 hrs to fix

    Method __construct has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($overwrites = [])
        {
            $abnf = new Rfc4234();
    
            $ipv6 = new Rfc3513();
    Severity: Minor
    Found in src/Library/Rfc4408.php - About 1 hr to fix

      Method __construct has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct($overwrites = [])
          {
              /*
               * Support rules.
               * These are not part of the published specification, but help make the published rules more manageable without
      Severity: Minor
      Found in src/Library/Rfc2234.php - About 1 hr to fix

        Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function __construct($group, $name, $input, int $offset, $length, $children = [], $class = null)
        Severity: Major
        Found in src/Core/Token.php - About 50 mins to fix

          Function parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function parse(&$input, $offset, Context $context)
              {
                  $childMatches = [];
          
                  $this->pushSpacer($context);
          Severity: Minor
          Found in src/Parser/Structure/Sequence.php - About 45 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

          Method makeMatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function makeMatch($success, &$input, $offset, $length = 0, &$successes = [])
          Severity: Minor
          Found in src/Parser/Parser.php - About 35 mins to fix

            Method resolveToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function resolveToken($input, $offset, $length, &$children, $class)
            Severity: Minor
            Found in src/Parser/Output/TokenTrait.php - About 35 mins to fix

              Avoid too many return statements within this method.
              Open

                      return parent::__get($name);
              Severity: Major
              Found in src/Match/Success.php - About 30 mins to fix

                Function build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function build()
                    {
                        if ($this->parser === null) {
                            $this->parser = $this->definition->generator;
                            if (!$this->parser instanceof Parser) {
                Severity: Minor
                Found in src/Builder/Implementation.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

                Function validateResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function validateResults(AbstractMatch $match, $text)
                    {
                        $results = [];
                        if ($match instanceof Success) {
                            $results = $match->results;
                Severity: Minor
                Found in src/Builder/Implementation.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