MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Function smarty_modifiercompiler_escape has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function smarty_modifiercompiler_escape($params, $compiler)
{
    static $_double_encode = null;
    if ($_double_encode === null) {
        $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
Severity: Minor
Found in include/smarty/libs/plugins/modifiercompiler.escape.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 yy_is_expected_token has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function yy_is_expected_token($token)
    {
        if ($token === 0) {
            return true; // 0 is not part of this
        }
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.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 yy_is_expected_token has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function yy_is_expected_token($token)
    {
        if ($token === 0) {
            return true; // 0 is not part of this
        }
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 smarty_block_textformat has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function smarty_block_textformat($params, $content, $template, &$repeat)
{
    if (is_null($content)) {
        return;
    }
Severity: Major
Found in include/smarty/libs/plugins/block.textformat.php - About 2 hrs to fix

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

        public function compile($args, $compiler, $parameter, $tag)
        {
            if (!isset($tag[5]) || substr($tag,-5) != 'close') {
                // opening tag of block plugin
                // check and get attributes

      Method doAnchors has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function doAnchors($text) {
          #
          # Turn Markdown link shortcuts into XHTML <a> tags.
          #
              if ($this->in_anchor) return $text;
      Severity: Major
      Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

        Method debug has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function debug($message)
            {
                $message = bin2hex($message);
                $messageId = substr($message, 16, 8);
                echo substr($message, 0, 16) . " NTLMSSP Signature<br />\n";

          Method doAnchors has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function doAnchors($text) {
              #
              # Turn Markdown link shortcuts into XHTML <a> tags.
              #
                  if ($this->in_anchor) return $text;
          Severity: Major
          Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

            Block has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Block extends Base {
              protected $table = 'blocks';
            
              /**
               * Specific method to fetch the latest block found
            Severity: Minor
            Found in include/classes/block.class.php - About 2 hrs to fix

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

                  public function __construct(Smarty_Internal_Template $_template)
                  {
                      $this->compile_id = $_template->compile_id;
                      $this->cache_id = $_template->cache_id;
                      $this->source = $_template->source;
              Severity: Major
              Found in include/smarty/libs/sysplugins/smarty_cacheresource.php - About 2 hrs to fix

                Method yy_is_expected_token has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function yy_is_expected_token($token)
                    {
                        if ($token === 0) {
                            return true; // 0 is not part of this
                        }
                Severity: Major
                Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 2 hrs to fix

                  Method yy_is_expected_token has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function yy_is_expected_token($token)
                      {
                          if ($token === 0) {
                              return true; // 0 is not part of this
                          }
                  Severity: Major
                  Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 2 hrs to fix

                    Method getPrice has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public function getPrice() {
                        $aData = $this->getApi($this->config['price']['url'], $this->config['price']['target']);
                        $strBase = $this->config['currency'];
                        $strQuote = $this->config['price']['currency'];
                        // Check the API type for configured URL
                    Severity: Major
                    Found in include/classes/tools.class.php - About 2 hrs to fix

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

                        public function __construct($config, &$memcache, $request='') {
                          $this->cache = $memcache;
                          // set our config options
                          $userORip = $_SERVER['REMOTE_ADDR'].@$_SERVER['HTTP_USER_AGENT'];
                          // prep stuff we need to check this request
                      Severity: Major
                      Found in include/classes/memcache_ad.class.php - About 2 hrs to fix

                        Method streamToMime has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
                            {
                                $bufferLength = 78;
                                $headerData = '';
                        
                        
                        Severity: Major
                        Found in include/lib/swiftmailer/classes/Swift/Signers/SMimeSigner.php - About 2 hrs to fix

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

                          function smarty_modifier_date_format($string, $format=null, $default_date='', $formatter='auto')
                          {
                              if ($format === null) {
                                  $format = Smarty::$_DATE_FORMAT;
                              }
                          Severity: Minor
                          Found in include/smarty/libs/plugins/modifier.date_format.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 run_0010 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function run_0010() {
                            // Ugly but haven't found a better way
                            global $setting, $config, $statistics, $block, $mysqli;
                          
                            // Version information
                          Severity: Minor
                          Found in upgrade/definitions/0.0.9_to_0.0.10.inc.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 smarty_modifier_truncate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
                          {
                              if ($length == 0)
                                  return '';
                          
                          
                          Severity: Minor
                          Found in include/smarty/libs/plugins/modifier.truncate.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 compile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function compile($args, $compiler, $parameter)
                              {
                                  $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
                                  $compiled_ref = ' ';
                                  $variable = trim($_index[0], "'");

                          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 compile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function compile($args, $compiler, $parameter, $tag, $method)
                              {
                                  // check and get attributes
                                  $_attr = $this->getAttributes($compiler, $args);
                                  if ($_attr['nocache'] === true) {

                          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