Showing 12 of 264 total issues

Function buildWithoutCache has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildWithoutCache(array $data): string
    {
        $code     = [];
        $lastLast = null;
        $last     = null;
Severity: Minor
Found in src/Flow/Flow.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

File Flow.php has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Bavix\Flow;

use Bavix\Exceptions\Invalid;
Severity: Minor
Found in src/Flow/Flow.php - About 5 hrs to fix

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

        public function buildWithoutCache(array $data): string
        {
            $code     = [];
            $lastLast = null;
            $last     = null;
    Severity: Major
    Found in src/Flow/Flow.php - About 3 hrs to fix

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

      class Flow
      {
      
          const VERSION = '1.0.6';
      
      
      Severity: Minor
      Found in src/Flow/Flow.php - About 2 hrs to fix

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

            public function compile(string $view): string
            {
                $path      = $this->native()->path($view . $this->ext());
                $this->tpl = \file_get_contents($path);
                $tokens    = $this->lexer()->tokens($this->tpl);
        Severity: Minor
        Found in src/Flow/Flow.php - About 1 hr to fix

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

              protected function syntax(string $key, array $data)
              {
                  foreach ($data['directives'] ?? [] as $_key => $directive)
                  {
                      $this->data($_key, $directive ?: []);
          Severity: Minor
          Found in src/Flow/Lexeme.php - About 1 hr to fix

            Method testExtends has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testExtends()
                {
            
                    $codeWithoutComments = <<<code
                <h1>{{ message }}</h1>
            Severity: Minor
            Found in tests/Flow/Directives/MinifyTest.php - About 1 hr to fix

              Method testComments has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testComments()
                  {
              
                      $code = <<<code
                      <!-- print message -->
              Severity: Minor
              Found in tests/Flow/Directives/MinifyTest.php - About 1 hr to fix

                Method testRaw has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testRaw()
                    {
                
                        $code = <<<code
                    {{ message }}
                Severity: Minor
                Found in tests/Flow/Directives/RawTest.php - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if ($last && (!$lastLast ||
                                      ($lastLast->type !== T_VARIABLE &&
                                          $lastLast->type !== Validator::T_ENDBRACKET &&
                                          $lastLast->type !== Validator::T_ENDARRAY))
                                  && $last->type === Validator::T_DOT)
                  Severity: Major
                  Found in src/Flow/Flow.php - About 40 mins to fix

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

                        public function compile(string $view): string
                        {
                            $path      = $this->native()->path($view . $this->ext());
                            $this->tpl = \file_get_contents($path);
                            $tokens    = $this->lexer()->tokens($this->tpl);
                    Severity: Minor
                    Found in src/Flow/Flow.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 loader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function loader($file)
                        {
                            foreach ($this->folders as $folder)
                            {
                                foreach (FileLoader::extensions() as $ext)
                    Severity: Minor
                    Found in src/Flow/Lexeme.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