bb-drummer/phpagstract

View on GitHub

Showing 66 of 75 total issues

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

    public function compile() 
    {

        $attr = ($this->getAttributes());
        
Severity: Minor
Found in src/PHPagstract/Symbol/Symbols/Tokens/PagstractIfVisible.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 parseAttribute has 45 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/Element.php - About 1 hr to fix

    Function handleSearchResults has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            var handleSearchResults = function(searchResults, query) {
                $(document).unbind('keydown');
    
                $.each(searchResults, function (index, searchResult) {
                    resultsList.append('<li n="' + index + '" class="search-result"><a href="' + searchResult.link + '">' + searchResult.title + '</a></li>');
    Severity: Minor
    Found in docs/freiheit/assets/js/theme.main.js - About 1 hr to fix

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

          public function parse($html)
          {
              $html = ltrim($html);
      
              // Get token position.
      Severity: Minor
      Found in src/PHPagstract/Token/Tokens/Element.php - About 1 hr to fix

        Method symbolize has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function symbolize($data, AbstractPropertySymbol $parent = null, $name = null) 
            {
                
                if (($parent === null)) {
                    // no parent, so create a root node
        Severity: Minor
        Found in src/PHPagstract/Symbol/PropertyReferenceSymbolizer.php - About 1 hr to fix

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

              public function isClosingElementImplied($html)
              {
                  $parent = $this->getParent();
                  if ($parent === null || !($parent instanceof self)) {
                      return false;
          Severity: Minor
          Found in src/PHPagstract/Token/Tokens/Element.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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render(SymbolCollection $symbols) 
              {
                  $rendered = '';
                  $symbolsIterator = $symbols->getIterator();
                  $symbolsIterator->rewind();
          Severity: Minor
          Found in src/PHPagstract/Renderer/RendererAbstract.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 setDropdown has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function setDropdown(select) {
                  var container = select.parent();
                  var svg = '<svg width="10px" height="10px" viewBox="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g class="ht-select-button-icon"><path d="M2,3 L8,3 L5,7 L2,3 Z"></path></g></svg>';
                  var toggle = $('<a class="ht-select-button"><span>' + createOptionText(select.find('option:selected')) + '</span>' + svg + '</a>');
                  container.append(toggle);
          Severity: Minor
          Found in docs/freiheit/assets/js/theme.main.js - About 1 hr to fix

            Function toogleDropdown has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function toogleDropdown(container, open) {
                    if (open) {
                        $('body').bind('click', function (e) {
                            e.preventDefault();
                            if ($(e.target).is(container.find('*')))return;
            Severity: Minor
            Found in docs/freiheit/assets/js/theme.main.js - About 1 hr to fix

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

                  public function parse($html)
                  {
              
                      // Get token position.
                      $positionArray = ResourceTokenizer::getPosition($html);
              Severity: Minor
              Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractResource.php - About 1 hr to fix

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

                    public function __construct($throwOnError = false)
                    {
                        $this->throwOnError = (boolean) $throwOnError;
                        
                        TokenFactory::clearMatchings();
                Severity: Minor
                Found in src/PHPagstract/Token/PagstractTokenizer.php - About 1 hr to fix

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

                      public function resolvePropertyByReference($reference)
                      {
                          
                      
                          if (strpos($reference, "../") === 0) {
                  Severity: Minor
                  Found in src/PHPagstract/Page/Resolver/PropertyResolver.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 parseContents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseContents($html)
                      {
                          if (ltrim($html) == '') {
                              return '';
                          }
                  Severity: Minor
                  Found in src/PHPagstract/Token/Tokens/Element.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 setDataStream has 34 lines of code (exceeds 25 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 1 hr to fix

                    Function initSearch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function initSearch() {
                            var debounce = function(func, wait) {
                                var timeout;
                                var result;
                                return function() {
                    Severity: Minor
                    Found in docs/freiheit/assets/js/theme.main.js - About 1 hr to fix

                      Method parseContents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function parseContents($html)
                          {
                              if (ltrim($html) == '') {
                                  return '';
                              }
                      Severity: Minor
                      Found in src/PHPagstract/Token/Tokens/Element.php - About 1 hr to fix

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

                            public static function registerMatching($className, $regexStart = null, $regexEnd = null) 
                            {
                                if (array_key_exists($className, self::$matchings)) {
                                    throw new TokenFactoryException("Token has been registered already");
                                }
                        Severity: Minor
                        Found in src/PHPagstract/Token/Tokens/TokenFactory.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 symbolize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function symbolize($data, AbstractPropertySymbol $parent = null, $name = null) 
                            {
                                
                                if (($parent === null)) {
                                    // no parent, so create a root node
                        Severity: Minor
                        Found in src/PHPagstract/Symbol/PropertyReferenceSymbolizer.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 resolveFilepath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function resolveFilepath($filename) 
                            {
                                $themeId = $this->getThemeId();
                                $paths = $this->findThemePaths($themeId);
                                // finally add base/
                        Severity: Minor
                        Found in src/PHPagstract/Page/Resolver/FilepathResolver.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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function parse($html)
                            {
                                // Get token position.
                                $positionArray = ResourceTokenizer::getPosition($html);
                                $this->setLine($positionArray['line']);
                        Severity: Minor
                        Found in src/PHPagstract/Token/Tokens/Pagstract/PagstractResourceText.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