finally-a-fast/faftephp

View on GitHub

Showing 45 of 149 total issues

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

<?php

declare(strict_types=1);

namespace Faf\TemplateEngine;
Severity: Major
Found in src/Parser.php - About 2 days to fix

    Function prepareNode has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function prepareNode(
            DOMXPath $xPath,
            HTML5DOMElement $domNode,
            ParserElement $parserElement,
            string $currentTagName
    Severity: Minor
    Found in src/Parser.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

    Parser has 53 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Parser extends BaseObject
    {
        public const ROOT = 'root';
    
        public const MODE_PROD = 0;
    Severity: Major
    Found in src/Parser.php - About 7 hrs to fix

      Method prepareNode has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function prepareNode(
              DOMXPath $xPath,
              HTML5DOMElement $domNode,
              ParserElement $parserElement,
              string $currentTagName
      Severity: Major
      Found in src/Parser.php - About 6 hrs to fix

        Function loadAllowedChildElements has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function loadAllowedChildElements(): array
            {
                $debugId = $this->debugStart('Load allowed child elements');
                $key = 'fafte-allowed-child-elements-' . md5(implode('', array_keys($this->parserElements)));
                $allowedChildElements = null;
        Severity: Minor
        Found in src/Parser.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 parseElements has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseElements(string $string, string $currentTagName, bool $rawData = false)
            {
                $parentLanguage = $this->currentLanguage;
                $this->currentLanguage = $this->getLanguage();
        
        
        Severity: Minor
        Found in src/Parser.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

        Method parseElements has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function parseElements(string $string, string $currentTagName, bool $rawData = false)
            {
                $parentLanguage = $this->currentLanguage;
                $this->currentLanguage = $this->getLanguage();
        
        
        Severity: Major
        Found in src/Parser.php - About 4 hrs to fix

          Function htmlTag has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              public function htmlTag(
                  string $name,
                  string $content = '',
                  ?array $options = [],
                  string $attributePrefix = ''
          Severity: Minor
          Found in src/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

          Function getValue has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function &getValue(&$data, string $path, bool $callLastClosure = true)
              {
                  static::checkForClosure($data);
          
                  $workData = $data;
          Severity: Minor
          Found in src/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

          ElementSetting has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ElementSetting extends BaseObject
          {
              /**
               * @var string
               */
          Severity: Minor
          Found in src/Helpers/ElementSetting.php - About 2 hrs to fix

            ParserElement has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class ParserElement extends BaseObject
            {
                use TagTrait;
            
                /**
            Severity: Minor
            Found in src/Helpers/ParserElement.php - About 2 hrs to fix

              Method elementSettings has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function elementSettings(): array
                  {
                      return [
                          new ElementSetting([
                              'name' => 'datetime',
              Severity: Major
              Found in src/Elements/TimeTag.php - About 2 hrs to fix

                Method elementSettings has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function elementSettings(): array
                    {
                        return [
                            new ElementSetting([
                                'name' => 'loop-each',
                Severity: Minor
                Found in src/Elements/Loop.php - About 2 hrs to fix

                  Method loadAllowedChildElements has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function loadAllowedChildElements(): array
                      {
                          $debugId = $this->debugStart('Load allowed child elements');
                          $key = 'fafte-allowed-child-elements-' . md5(implode('', array_keys($this->parserElements)));
                          $allowedChildElements = null;
                  Severity: Minor
                  Found in src/Parser.php - About 1 hr to fix

                    Method getValue has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function &getValue(&$data, string $path, bool $callLastClosure = true)
                        {
                            static::checkForClosure($data);
                    
                            $workData = $data;
                    Severity: Minor
                    Found in src/Parser.php - About 1 hr to fix

                      Function getRawValue has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function &getRawValue($value)
                          {
                              if (is_array($value) || is_object($value)) {
                                  return $value;
                              }
                      Severity: Minor
                      Found in src/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 run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function run(): string
                          {
                              //TODO default settings from parser
                              //'machine_time_default_format', 'yyyy-MM-dd HH:mm:ss';
                              //'human_time_default_format', 'medium';
                      Severity: Minor
                      Found in src/Elements/TimeTag.php - About 1 hr to fix

                        Method elementSettings has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function elementSettings(): array
                            {
                                return [
                                    new ElementSetting([
                                        'name' => 'string',
                        Severity: Minor
                        Found in src/Elements/FormatAsDate.php - About 1 hr to fix

                          Method htmlTag has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function htmlTag(
                                  string $name,
                                  string $content = '',
                                  ?array $options = [],
                                  string $attributePrefix = ''
                          Severity: Minor
                          Found in src/Parser.php - About 1 hr to fix

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

                                public static function formatParams(array $rawParams, bool $setAttributeData, Parser $parser): array
                                {
                                    $params = [];
                            
                                    foreach ($rawParams as $name => $value) {
                            Severity: Minor
                            Found in src/Helpers/DataHelper.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

                            Severity
                            Category
                            Status
                            Source
                            Language