kpumuk/codecolorer

View on GitHub
codecolorer-core.php

Summary

Maintainability
D
2 days
Test Coverage
F
55%

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

    private function performHighlightGeshi($content, $options)
    {
        /* Geshi configuration */
        if (!$this->geshi) {
            $this->geshi = new GeSHi();
Severity: Minor
Found in codecolorer-core.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 codecolorer-core.php has 319 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
CodeColorer plugin core part
https://kpumuk.info/projects/wordpress-plugins/codecolorer
*/
Severity: Minor
Found in codecolorer-core.php - About 3 hrs to fix

    The class CodeColorer has an overall complexity of 65 which is very high. The configured complexity threshold is 50.
    Open

    class CodeColorer
    {
        private $blocks = array();
        private $comments = array();
    
    
    Severity: Minor
    Found in codecolorer-core.php by phpmd

    Method performHighlightGeshi has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function performHighlightGeshi($content, $options)
        {
            /* Geshi configuration */
            if (!$this->geshi) {
                $this->geshi = new GeSHi();
    Severity: Major
    Found in codecolorer-core.php - About 2 hrs to fix

      Method performHighlightCodeBlock has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
          {
              // Parse options
              $options = CodeColorerOptions::parseOptions($opts, $suffix);
      
      
      Severity: Major
      Found in codecolorer-core.php - About 2 hrs to fix

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

            private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
            {
                // Parse options
                $options = CodeColorerOptions::parseOptions($opts, $suffix);
        
        
        Severity: Minor
        Found in codecolorer-core.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 getInstance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function &getInstance()
            {
                static $instance = null;
        
                if (null === $instance) {
        Severity: Minor
        Found in codecolorer-core.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 addContainer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function addContainer($html, $options, $numLines)
            {
                $customCSSClass = empty($options['class']) ? '' : ' ' . $options['class'];
                if ($options['inline']) {
                    $theme = empty($options['inline_theme']) ? 'default' : $options['inline_theme'];
        Severity: Minor
        Found in codecolorer-core.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 beforeHighlightCodeBlock has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function beforeHighlightCodeBlock($content)
            {
                $helper = $this;
        
                $content = preg_replace_callback(
        Severity: Minor
        Found in codecolorer-core.php - About 1 hr to fix

          Method addContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function addContainer($html, $options, $numLines)
              {
                  $customCSSClass = empty($options['class']) ? '' : ' ' . $options['class'];
                  if ($options['inline']) {
                      $theme = empty($options['inline_theme']) ? 'default' : $options['inline_theme'];
          Severity: Minor
          Found in codecolorer-core.php - About 1 hr to fix

            Method performHighlightCodeBlock has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
            Severity: Minor
            Found in codecolorer-core.php - About 45 mins to fix

              Function getOptionsPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getOptionsPage()
                  {
                      if (!$this->optionsPage) {
                          if (!class_exists('CodeColorerAdmin')) {
                              $path = dirname(__FILE__);
              Severity: Minor
              Found in codecolorer-core.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

              The method performHighlightGeshi() has an NPath complexity of 7776. The configured NPath complexity threshold is 200.
              Open

                  private function performHighlightGeshi($content, $options)
                  {
                      /* Geshi configuration */
                      if (!$this->geshi) {
                          $this->geshi = new GeSHi();
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              NPathComplexity

              Since: 0.1

              The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

              Example

              class Foo {
                  function bar() {
                      // lots of complicated code
                  }
              }

              Source https://phpmd.org/rules/codesize.html#npathcomplexity

              The method performHighlightGeshi() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
              Open

                  private function performHighlightGeshi($content, $options)
                  {
                      /* Geshi configuration */
                      if (!$this->geshi) {
                          $this->geshi = new GeSHi();
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              The method addContainer() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
              Open

                  private function addContainer($html, $options, $numLines)
                  {
                      $customCSSClass = empty($options['class']) ? '' : ' ' . $options['class'];
                      if ($options['inline']) {
                          $theme = empty($options['inline_theme']) ? 'default' : $options['inline_theme'];
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              Missing class import via use statement (line '217', column '32').
              Open

                          $this->geshi = new GeSHi();
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '376', column '38').
              Open

                          $this->optionsPage = new CodeColorerAdmin($this);
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              The method getBlockID has a boolean flag argument $comment, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  private function getBlockID($content, $comment = false, $before = '<div>', $after = '</div>')
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              BooleanArgumentFlag

              Since: 1.4.0

              A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

              Example

              class Foo {
                  public function bar($flag = true) {
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

              Missing class import via use statement (line '405', column '29').
              Open

                          $instance = new CodeColorer();
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              The method getInstance uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              $instance->geshiExternal = true;
                          }
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              The method performHighlightGeshi uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              $table .= 'class="line-numbers"';
                          }
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'CodeColorerOptions' in method 'performHighlightGeshi'.
              Open

                              $table .= 'style="' . CodeColorerOptions::feedLineNumbersStyle() . '"';
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'CodeColorerOptions' in method 'performHighlightGeshi'.
              Open

                              $this->geshi->set_overall_style(CodeColorerOptions::feedOverallStyle());
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method addContainer uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          $theme = empty($options['theme']) ? 'default' : $options['theme'];
                          $style = 'style="';
                          if ($options['nowrap']) {
                              $style .= 'overflow:auto;white-space:nowrap;';
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              The method performHighlightGeshi uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          $geshi->enable_classes(false);
                      }
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'CodeColorerOptions' in method 'performHighlightCodeBlock'.
              Open

                      $options = CodeColorerOptions::parseOptions($opts, $suffix);
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid unused private methods such as 'performHighlightCodeBlock'.
              Open

                  private function performHighlightCodeBlock($text, $opts, $content, $suffix = '', $before = '', $after = '')
                  {
                      // Parse options
                      $options = CodeColorerOptions::parseOptions($opts, $suffix);
              
              
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              UnusedPrivateMethod

              Since: 0.2

              Unused Private Method detects when a private method is declared but is unused.

              Example

              class Something
              {
                  private function foo() {} // unused
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

              Avoid unused private methods such as 'performProtectComment'.
              Open

                  private function performProtectComment($text, $content, $before, $after)
                  {
                      $text = str_replace(array("\\\"", "\\\'"), array ("\"", "\'"), $text);
              
                      $blockID = $this->getBlockID($content, true, '', '');
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              UnusedPrivateMethod

              Since: 0.2

              Unused Private Method detects when a private method is declared but is unused.

              Example

              class Something
              {
                  private function foo() {} // unused
              }

              Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

              Possibly zero write references to private property \CodeColorer->samplePhpCode
              Open

                  private $samplePhpCode = '
              Severity: Minor
              Found in codecolorer-core.php by phan

              Call to method set_highlight_lines_extra_style from undeclared class \GeSHi
              Open

                          $geshi->set_highlight_lines_extra_style('background-color:#ffff66');
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_header_type from undeclared class \GeSHi
              Open

                      $geshi->set_header_type($options['inline'] ? GESHI_HEADER_NONE : GESHI_HEADER_DIV);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \wp_upload_dir()
              Open

                          $uploadPath = wp_upload_dir();
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method enable_line_numbers from undeclared class \GeSHi
              Open

                          $this->geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS, 1);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method enable_strict_mode from undeclared class \GeSHi
              Open

                          $geshi->enable_strict_mode($options['strict']);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \is_feed()
              Open

                          if (is_feed()) {
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_language from undeclared class \GeSHi
              Open

                      $geshi->set_language($options['lang']);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method enable_classes from undeclared class \GeSHi
              Open

                          $geshi->enable_classes($options['theme'] != 'geshi');
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method parse_code from undeclared class \GeSHi
              Open

                      $result = $geshi->parse_code();
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method error from undeclared class \GeSHi
              Open

                      if ($geshi->error()) {
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \__() (Did you mean _())
              Open

                      $disable = ' <a href="options-general.php?page=codecolorer.php&amp;disable=' . $type . '">' . __('Close', 'codecolorer') . '</a>';
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_overall_style from undeclared class \GeSHi
              Open

                          $geshi->set_overall_style('');
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_overall_style from undeclared class \GeSHi
              Open

                              $this->geshi->set_overall_style(CodeColorerOptions::feedOverallStyle());
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \is_feed()
              Open

                      if (!is_feed()) {
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method error from undeclared class \GeSHi
              Open

                          return $geshi->error();
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method highlight_lines_extra from undeclared class \GeSHi
              Open

                          $geshi->highlight_lines_extra($highlight);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Reference to undeclared constant \GESHI_HEADER_NONE
              Open

                      $geshi->set_header_type($options['inline'] ? GESHI_HEADER_NONE : GESHI_HEADER_DIV);
              Severity: Minor
              Found in codecolorer-core.php by phan

              Call to undeclared function \path_join()
              Open

                          $filePath = realpath(path_join($baseDir, $options['file']));
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method __construct from undeclared class \GeSHi
              Open

                          $this->geshi = new GeSHi();
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_tab_width from undeclared class \GeSHi
              Open

                      $geshi->set_tab_width($options['tab_size']);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Reference to undeclared constant \GESHI_HEADER_DIV
              Open

                      $geshi->set_header_type($options['inline'] ? GESHI_HEADER_NONE : GESHI_HEADER_DIV);
              Severity: Minor
              Found in codecolorer-core.php by phan

              Call to undeclared function \__() (Did you mean _())
              Open

                          $this->showWarning('concurrent', __('CodeColorer has detected a problem.', 'codecolorer'), sprintf(__('We found another plugin based on GeSHi library in your system. CodeColorer will work, but our version of GeSHi contain some patches, so we can\'t guarantee an ideal code highlighting now. Please review your <a href="%1$s">plugins</a>, maybe you don\'t need them all.', 'codecolorer'), "plugins.php"));
              Severity: Critical
              Found in codecolorer-core.php by phan

              Reference to undeclared constant \GESHI_NO_LINE_NUMBERS
              Open

                          $this->geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS, 1);
              Severity: Minor
              Found in codecolorer-core.php by phan

              Call to method enable_keyword_links from undeclared class \GeSHi
              Open

                          $geshi->enable_keyword_links(false);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Unused definition of variable $result
              Open

                      $result = '';
              Severity: Minor
              Found in codecolorer-core.php by phan

              Call to method set_overall_style from undeclared class \GeSHi
              Open

                              $geshi->set_overall_style('white-space:nowrap');
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \is_feed()
              Open

                          if (is_feed()) {
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \is_feed()
              Open

                          if (is_feed()) {
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to undeclared function \is_feed()
              Open

                          $style .= $this->getDimensionRule('width', is_feed() ? $options['rss_width'] : $options['width']);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_source from undeclared class \GeSHi
              Open

                      $geshi->set_source($content);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method set_overall_class from undeclared class \GeSHi
              Open

                      $geshi->set_overall_class('codecolorer');
              Severity: Critical
              Found in codecolorer-core.php by phan

              Call to method enable_classes from undeclared class \GeSHi
              Open

                          $geshi->enable_classes(false);
              Severity: Critical
              Found in codecolorer-core.php by phan

              Each class must be in a namespace of at least one level (a top-level vendor name)
              Open

              class CodeColorer
              Severity: Minor
              Found in codecolorer-core.php by phpcodesniffer

              Avoid variables with short names like $to. Configured minimum length is 3.
              Open

                              list($from, $to) = array_pad(explode('-', $v, 2), 2, null);
              Severity: Minor
              Found in codecolorer-core.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Line exceeds 120 characters; contains 147 characters
              Open

                      echo '<div id="codecolorer-' . $type . '" class="updated fade"><p><strong>' . $title . "</strong> " . $message . $disable . "</p></div>\n";
              Severity: Minor
              Found in codecolorer-core.php by phpcodesniffer

              Inline control structures are not allowed
              Open

                              if (!file_exists("$path/codecolorer-admin.php")) return false;
              Severity: Minor
              Found in codecolorer-core.php by phpcodesniffer

              Line exceeds 120 characters; contains 416 characters
              Open

                          $this->showWarning('concurrent', __('CodeColorer has detected a problem.', 'codecolorer'), sprintf(__('We found another plugin based on GeSHi library in your system. CodeColorer will work, but our version of GeSHi contain some patches, so we can\'t guarantee an ideal code highlighting now. Please review your <a href="%1$s">plugins</a>, maybe you don\'t need them all.', 'codecolorer'), "plugins.php"));
              Severity: Minor
              Found in codecolorer-core.php by phpcodesniffer

              Line exceeds 120 characters; contains 138 characters
              Open

                      $disable = ' <a href="options-general.php?page=codecolorer.php&amp;disable=' . $type . '">' . __('Close', 'codecolorer') . '</a>';
              Severity: Minor
              Found in codecolorer-core.php by phpcodesniffer

              There are no issues that match your filters.

              Category
              Status