Showing 88 of 88 total issues

File Template.php has 1179 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * This file is part of Fenom.
 *
 * (c) 2013 Ivan Shalganov
Severity: Major
Found in src/Fenom/Template.php - About 3 days to fix

    File Fenom.php has 769 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * This file is part of Fenom.
     *
     * (c) 2013 Ivan Shalganov
    Severity: Major
    Found in src/Fenom.php - About 1 day to fix

      Function parseExpr has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseExpr(Tokenizer $tokens, ?bool &$is_var = false): string
          {
              $exp  = array();
              $var  = false; // last term was: true - variable, false - mixed
              $op   = false; // last exp was operator
      Severity: Minor
      Found in src/Fenom/Template.php - About 1 day 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 631 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*
       * This file is part of Fenom.
       *
       * (c) 2013 Ivan Shalganov
      Severity: Major
      Found in src/Fenom/Compiler.php - About 1 day to fix

        Function parseTerm has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseTerm(Tokenizer $tokens, ?bool &$is_var = false, int $allows = -1): string
            {
                $is_var = false;
                if ($tokens->is(Tokenizer::MACRO_UNARY)) {
                    $unary = $tokens->getAndNext();
        Severity: Minor
        Found in src/Fenom/Template.php - About 7 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

        Fenom has 54 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Fenom
        {
            const VERSION = '3.0';
            const REV = 2;
            /* Actions */
        Severity: Major
        Found in src/Fenom.php - About 7 hrs to fix

          File Tokenizer.php has 464 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*
           * This file is part of Fenom.
           *
           * (c) 2013 Ivan Shalganov
          Severity: Minor
          Found in src/Fenom/Tokenizer.php - About 7 hrs to fix

            Compiler has 46 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Compiler
            {
                /**
                 * Tag {include ...}
                 *
            Severity: Minor
            Found in src/Fenom/Compiler.php - About 6 hrs to fix

              Template has 45 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Template extends Render
              {
                  const VAR_NAME = '$var';
                  const TPL_NAME = '$tpl';
              
              
              Severity: Minor
              Found in src/Fenom/Template.php - About 6 hrs to fix

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

                    public function parseVariable(Tokenizer $tokens, ?string $var = null): ?string
                    {
                        if (!$var) {
                            if ($tokens->isNext('@')) {
                //                $v = $tokens->get(T_VARIABLE);
                Severity: Minor
                Found in src/Fenom/Template.php - About 5 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 parseTernary has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function parseTernary(Tokenizer $tokens, $var, $is_var): string
                    {
                        $empty = $tokens->is('?');
                        $tokens->next();
                        if ($tokens->is(":", "?")) {
                Severity: Minor
                Found in src/Fenom/Template.php - About 5 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 compile has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function compile()
                    {
                        $end = $pos = 0;
                        foreach ($this->_fenom->getPreFilters() as $filter) {
                            $this->_src = call_user_func($filter, $this, $this->_src);
                Severity: Minor
                Found in src/Fenom/Template.php - About 5 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 parseQuote has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function parseQuote(Tokenizer $tokens): string
                    {
                        if ($tokens->is('"')) {
                            $stop = $tokens->current();
                            $_str = '"';
                Severity: Minor
                Found in src/Fenom/Template.php - About 5 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 parseTerm has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function parseTerm(Tokenizer $tokens, ?bool &$is_var = false, int $allows = -1): string
                    {
                        $is_var = false;
                        if ($tokens->is(Tokenizer::MACRO_UNARY)) {
                            $unary = $tokens->getAndNext();
                Severity: Major
                Found in src/Fenom/Template.php - About 5 hrs to fix

                  Function tagImport has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function tagImport(Tokenizer $tokens, Tag $tag): string
                      {
                          $tpl    = $tag->tpl;
                          $import = array();
                          if ($tokens->is('[')) {
                  Severity: Minor
                  Found in src/Fenom/Compiler.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

                  Tokenizer has 35 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Tokenizer
                  {
                      const TOKEN      = 0;
                      const TEXT       = 1;
                      const WHITESPACE = 2;
                  Severity: Minor
                  Found in src/Fenom/Tokenizer.php - About 4 hrs to fix

                    Function __construct has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function __construct(string $query)
                        {
                            $this->_curr = null;
                            $this->_next = null;
                            $this->_prev = null;
                    Severity: Minor
                    Found in src/Fenom/Tokenizer.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

                    Method parseExpr has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function parseExpr(Tokenizer $tokens, ?bool &$is_var = false): string
                        {
                            $exp  = array();
                            $var  = false; // last term was: true - variable, false - mixed
                            $op   = false; // last exp was operator
                    Severity: Major
                    Found in src/Fenom/Template.php - About 3 hrs to fix

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

                          public function compile()
                          {
                              $end = $pos = 0;
                              foreach ($this->_fenom->getPreFilters() as $filter) {
                                  $this->_src = call_user_func($filter, $this, $this->_src);
                      Severity: Major
                      Found in src/Fenom/Template.php - About 3 hrs to fix

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

                            public function __construct(string $query)
                            {
                                $this->_curr = null;
                                $this->_next = null;
                                $this->_prev = null;
                        Severity: Major
                        Found in src/Fenom/Tokenizer.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language