pug-php/js-phpize

View on GitHub

Showing 162 of 162 total issues

File Parser.php has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace JsPhpize\Parser;

use JsPhpize\JsPhpize;
Severity: Minor
Found in src/JsPhpize/Parser/Parser.php - About 5 hrs to fix

    Function appendFunctionsCalls has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
        {
            while ($token = $this->get(0)) {
                if ($token->is('{') || $token->expectNoLeftMember()) {
                    throw $this->unexpected($this->next());
    Severity: Minor
    Found in src/JsPhpize/Parser/TokenExtractor.php - About 4 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 parseParentheses has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseParentheses($allowedSeparators = [',', ';'])
        {
            $parentheses = new Parenthesis();
            $exceptionInfos = $this->exceptionInfos();
            $expectComma = false;
    Severity: Minor
    Found in src/JsPhpize/Parser/Parser.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

    File Compiler.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace JsPhpize\Compiler;
    
    use JsPhpize\JsPhpize;
    Severity: Minor
    Found in src/JsPhpize/Compiler/Compiler.php - About 3 hrs to fix

      The class Compiler has an overall complexity of 71 which is very high. The configured complexity threshold is 50.
      Open

      class Compiler
      {
          const DOT_DISABLED = 1;
      
          use DyiadeTrait;
      Severity: Minor
      Found in src/JsPhpize/Compiler/Compiler.php by phpmd

      Since: PHPMD 0.2.5

      The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

      Example:

      class Foo {
            public function bar() {
                if ($a == $b)  {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            public function baz() {
                if ($a == $b) {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            // Several other complex methods
        }

      Source: http://phpmd.org/rules/codesize.txt

      The class Scanner has 11 public methods. Consider refactoring Scanner to keep number of public methods under 10.
      Open

      class Scanner
      {
          public function scanUnexpected($matches)
          {
              throw $this->unexpected($this->valueToken('token', $matches));
      Severity: Minor
      Found in src/JsPhpize/Lexer/Scanner.php by phpmd

      Since: PHPMD 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. By default it ignores methods starting with 'get' or 'set'.

      Source: http://phpmd.org/rules/codesize.txt

      The class Parser has an overall complexity of 107 which is very high. The configured complexity threshold is 50.
      Open

      class Parser extends TokenExtractor
      {
          /**
           * @var JsPhpize
           */
      Severity: Minor
      Found in src/JsPhpize/Parser/Parser.php by phpmd

      Since: PHPMD 0.2.5

      The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

      Example:

      class Foo {
            public function bar() {
                if ($a == $b)  {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            public function baz() {
                if ($a == $b) {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            // Several other complex methods
        }

      Source: http://phpmd.org/rules/codesize.txt

      The class TokenExtractor has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
      Open

      abstract class TokenExtractor extends TokenCrawler
      {
          protected function getBracketsArrayItemKeyFromToken($token)
          {
              $typeAndValue = new BracketsArrayItemKey($token);

      Since: PHPMD 0.2.5

      The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

      Example:

      class Foo {
            public function bar() {
                if ($a == $b)  {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            public function baz() {
                if ($a == $b) {
                    if ($a1 == $b1) {
                        fiddle();
                    } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                    }
                }
            }
            // Several other complex methods
        }

      Source: http://phpmd.org/rules/codesize.txt

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

          protected function parseVariable($name)
          {
              $children = [];
              $variable = null;
      
      
      Severity: Minor
      Found in src/JsPhpize/Parser/Parser.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

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

          protected function appendFunctionsCalls(&$value, $previousToken = null, $applicant = null)
          {
              while ($token = $this->get(0)) {
                  if ($token->is('{') || $token->expectNoLeftMember()) {
                      throw $this->unexpected($this->next());
      Severity: Minor
      Found in src/JsPhpize/Parser/TokenExtractor.php - About 1 hr to fix

        Method render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render($input, $filename = null, array $variables = [])
            {
                if (is_array($filename)) {
                    $variables = $filename;
                    $filename = null;
        Severity: Minor
        Found in src/JsPhpize/JsPhpize.php - About 1 hr to fix

          Method parseParentheses has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function parseParentheses($allowedSeparators = [',', ';'])
              {
                  $parentheses = new Parenthesis();
                  $exceptionInfos = $this->exceptionInfos();
                  $expectComma = false;
          Severity: Minor
          Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

            Function parseHooksArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseHooksArray()
                {
                    $array = new HooksArray();
                    $exceptionInfos = $this->exceptionInfos();
                    $expectComma = false;
            Severity: Minor
            Found in src/JsPhpize/Parser/Parser.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

            Function parseBracketsArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseBracketsArray()
                {
                    $array = new BracketsArray();
                    $exceptionInfos = $this->exceptionInfos();
                    $expectComma = false;
            Severity: Minor
            Found in src/JsPhpize/Parser/Parser.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 parseKeywordStatement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function parseKeywordStatement($token)
                {
                    $name = $token->value;
                    $keyword = new Block($name);
            
            
            Severity: Minor
            Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

              Method parseVariable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function parseVariable($name)
                  {
                      $children = [];
                      $variable = null;
              
              
              Severity: Minor
              Found in src/JsPhpize/Parser/Parser.php - About 1 hr to fix

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

                    public function render($input, $filename = null, array $variables = [])
                    {
                        if (is_array($filename)) {
                            $variables = $filename;
                            $filename = null;
                Severity: Minor
                Found in src/JsPhpize/JsPhpize.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

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

                    protected function parseInstruction($block, $token, &$initNext)
                    {
                        if ($token->type === 'keyword') {
                            if ($token->isIn('var', 'const')) {
                                $initNext = true;
                Severity: Minor
                Found in src/JsPhpize/Parser/Parser.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 visitFunctionCall has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function visitFunctionCall(FunctionCall $functionCall, $indent)
                    {
                        $function = $functionCall->function;
                        $arguments = $functionCall->arguments;
                        $applicant = $functionCall->applicant;
                Severity: Minor
                Found in src/JsPhpize/Compiler/Compiler.php - About 1 hr to fix

                  Method compile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function compile($input, $filename = null)
                      {
                          $this->flags = 0;
                  
                          if ($filename === null) {
                  Severity: Minor
                  Found in src/JsPhpize/JsPhpize.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language