bb-drummer/phpagstract

View on GitHub

Showing 66 of 75 total issues

Method getHTML401NamedToNumeric has 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getHTML401NamedToNumeric() 
    {
        return array(
            ' '     => ' ',  // no-break space = non-breaking space, U+00A0 ISOnum
            '¡'    => '¡',  // inverted exclamation mark, U+00A1 ISOnum
Severity: Major
Found in src/PHPagstract/Symbol/Symbols/Tokens/PagstractSimpleValue.php - About 1 day to fix

    File theme.main.js has 516 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function($) {
        /**
         *
         * K15t Help Theme
         * Main Javascript
    Severity: Major
    Found in docs/freiheit/assets/js/theme.main.js - About 1 day to fix

      Function toString has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          public function toString() 
          {   
              
              $attr = ($this->getAttributes());
              
      Severity: Minor
      Found in src/PHPagstract/Symbol/Symbols/Tokens/PagstractList.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

      Function toString has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function toString() 
          {
              $EOL = $this->config()->EOL();
              $attr = ($this->getAttributes());
              
      Severity: Minor
      Found in src/PHPagstract/Symbol/Symbols/Tokens/Doctype.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 Element.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace PHPagstract\Token\Tokens;
      
      use PHPagstract\Token\MarkupTokenizer;
      Severity: Minor
      Found in src/PHPagstract/Token/Tokens/Element.php - About 3 hrs to fix

        Function findThemePaths has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function findThemePaths($themeId, $result = []) 
            {
                $themesDir = $this->getThemesDir();
                $paths = scandir($themesDir);
                
        Severity: Minor
        Found in src/PHPagstract/Page/Resolver/FilepathResolver.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 setDataStream has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function setDataStream($dataStream) 
            {
                // make sure, we will handle an object
                if (empty($dataStream)) {
                    // create generic data object
        Severity: Minor
        Found in src/PHPagstract/Page/PageAbstract.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 PagstractAbstractToken.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Pagstract token abstract class
         */
        namespace PHPagstract\Token\Tokens;
        Severity: Minor
        Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractAbstractToken.php - About 2 hrs to fix

          File PagstractSimpleValue.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * PHPagstract simple value reference token symbol class
           */
          namespace PHPagstract\Symbol\Symbols\Tokens;
          Severity: Minor
          Found in src/PHPagstract/Symbol/Symbols/Tokens/PagstractSimpleValue.php - About 2 hrs to fix

            Method toString has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function toString() 
                {   
                    
                    $attr = ($this->getAttributes());
                    
            Severity: Major
            Found in src/PHPagstract/Symbol/Symbols/Tokens/PagstractList.php - About 2 hrs to fix

              Function buildFromHtml has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function buildFromHtml($html, Token $parent = null, $throwOnError = false)
                  {
                      $matchCriteria = self::getMatchings();
                      foreach ($matchCriteria as $className => $regex) {
                          if (preg_match($regex["start"], $html) === 1) {
              Severity: Minor
              Found in src/PHPagstract/Token/Tokens/TokenFactory.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

              Function symbolize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function symbolize($token, $throwOnError = false) 
                  {
                      
                      // get token name "PagstactTokenName", fallback "PagstactMarkup" needed ?
                      $symbolName = ucfirst($token->getType());
              Severity: Minor
              Found in src/PHPagstract/Symbol/Symbols/SymbolFactory.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 isClosingElementImplied has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function isClosingElementImplied($html)
                  {
                      $parent = $this->getParent();
                      if ($parent === null || !($parent instanceof self)) {
                          return false;
              Severity: Major
              Found in src/PHPagstract/Token/Tokens/Element.php - About 2 hrs to fix

                Function searchSetup has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var searchSetup = function() {
                        var locationOrigin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
                        var pageLocation = locationOrigin + window.location.pathname;
                        var url = pageLocation.substr(0, pageLocation.lastIndexOf('/') + 1);
                
                
                Severity: Major
                Found in docs/freiheit/assets/js/scroll-search.js - About 2 hrs to fix

                  Function parseAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseAttribute($html)
                      {
                          $remainingHtml = ltrim($html);
                  
                          // Will match the first entire name/value attribute pair.
                  Severity: Minor
                  Found in src/PHPagstract/Token/Tokens/Element.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

                  Function parseAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseAttribute($html)
                      {
                          $remainingHtml = ltrim($html);
                  
                          // Will match the first entire name/value attribute pair.
                  Severity: Minor
                  Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractAbstractToken.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

                  Function doSearch has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function doSearch(query) {
                          var dropdown = $('.ht-search-input .ht-search-dropdown');
                          var resultsList = dropdown.find('ul');
                  
                          resultsList.empty();
                  Severity: Major
                  Found in docs/freiheit/assets/js/theme.main.js - About 2 hrs to fix

                    Method parse has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function parse($html)
                        {
                            $html = ltrim($html);
                    
                            // Get token position.
                    Severity: Major
                    Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractAbstractToken.php - About 2 hrs to fix

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

                          private function parseAttribute($html)
                          {
                              $remainingHtml = ltrim($html);
                      
                              // Will match the first entire name/value attribute pair.
                      Severity: Minor
                      Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractAbstractToken.php - About 1 hr to fix

                        Function resolve has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function resolve($tokens) 
                            {
                        
                                $symbols = new SymbolCollection();
                        
                        
                        Severity: Minor
                        Found in src/PHPagstract/Symbol/GenericSymbolizer.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