MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

    public function compile($args, $compiler, $parameter)
    {
        // check and get attributes
        $_attr = $this->getAttributes($compiler, $args);

Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_compile_if.php - About 2 hrs to fix

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

        public function beforeSendPerformed(Swift_Events_SendEvent $evt)
        {
            $message = $evt->getMessage();
            $this->_restoreMessage($message);
            $to = array_keys($message->getTo());
    Severity: Major
    Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php - About 2 hrs to fix

      Method yylex2 has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function yylex2()
          {
              $tokenMap = array (
                    1 => 0,
                    2 => 0,
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        foreach ($aMonitorCrons as $strCron) {
          $aCronStatus[$strCron] = array(
            'disabled' => $monitoring->getStatus($strCron . '_disabled'),
            'exit' => $monitoring->getStatus($strCron . '_status'),
            'active' => $monitoring->getStatus($strCron . '_active'),
        Severity: Major
        Found in include/pages/admin/monitoring.inc.php and 1 other location - About 2 hrs to fix
        include/pages/api/getcronjobstatus.inc.php on lines 31..41

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 123.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        foreach ($aCrons as $strCron) {
          $aCronStatus[$strCron] = array(
            'disabled' => $monitoring->getStatus($strCron . '_disabled'),
            'exit' => $monitoring->getStatus($strCron . '_status'),
            'active' => $monitoring->getStatus($strCron . '_active'),
        Severity: Major
        Found in include/pages/api/getcronjobstatus.inc.php and 1 other location - About 2 hrs to fix
        include/pages/admin/monitoring.inc.php on lines 14..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 123.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        function smarty_modifier_relative_date($timestamp, $days = false, $format = "M j, Y") {
          
          if (!is_numeric($timestamp)) {
            // It's not a time stamp, so try to convert it...
            $timestamp = strtotime($timestamp);
        Severity: Minor
        Found in include/smarty/libs/plugins/modifier.relative_date.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 processNocacheCode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processNocacheCode($content, $is_code)
            {
                // If the template is not evaluated and we have a nocache section and or a nocache tag
                if ($is_code && !empty($content)) {
                    // generate replacement code

        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 16 (exceeds 5 allowed). Consider refactoring.
        Open

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

        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 16 (exceeds 5 allowed). Consider refactoring.
        Open

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

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

          public function storeUptimeRobotStatus() {
            if ($api_keys = $this->setting->getValue('monitoring_uptimerobot_api_keys')) {
              $aJSONData = array();
              $url = 'https://api.uptimerobot.com';
              $aMonitors = explode(',', $api_keys);
        Severity: Minor
        Found in include/classes/monitoring.class.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 findUpstreamShare has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          public function findUpstreamShare($aBlock, $last=0) {
            // Many use stratum, so we create our stratum check first
            $version = pack("I*", sprintf('%08d', $aBlock['version']));
            $previousblockhash = pack("H*", swapEndian($aBlock['previousblockhash']));
            $merkleroot = pack("H*", swapEndian($aBlock['merkleroot']) );
        Severity: Minor
        Found in include/classes/share.class.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 checkHttpHeadersForMobile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function checkHttpHeadersForMobile()
            {
        
                foreach($this->getMobileHeaders() as $mobileHeader => $matchType){
                    if( isset($this->httpHeaders[$mobileHeader]) ){
        Severity: Minor
        Found in include/lib/Mobile_Detect.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 send has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function send(Swift_Mime_Message $message, &$failedRecipients = null)
            {
                $failedRecipients = (array) $failedRecipients;
                $command = $this->getCommand();
                $buffer = $this->getBuffer();
        Severity: Minor
        Found in include/lib/swiftmailer/classes/Swift/Transport/SendmailTransport.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 load has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function load(Smarty $smarty, $type)
            {
                // try smarty's cache
                if (isset($smarty->_resource_handlers[$type])) {
                    return $smarty->_resource_handlers[$type];
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_resource.php - About 2 hrs to fix

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

              public function yylex1()
              {
                  $tokenMap = array (
                        1 => 0,
                        2 => 0,
          Severity: Major
          Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 2 hrs to fix

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

              function getLastBlocksbyTime() {
                $this->debug->append("STA " . __METHOD__, 4);
                if ($data = $this->memcache->get(__FUNCTION__)) return $data;
                $stmt = $this->mysqli->prepare("
                  SELECT
            Severity: Major
            Found in include/classes/statistics.class.php - About 2 hrs to fix

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

                  public function read($length)
                  {
                      if ($this->_currentPos>=$this->_charCount) {
                        return false;
                      }

                File smarty_internal_compile_block.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * Smarty Internal Plugin Compile Block
                 *
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_compile_block.php - About 2 hrs to fix

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

                  function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true)
                  {
                      $_output = '';
                  
                      if (is_object($value)) {
                  Severity: Major
                  Found in include/smarty/libs/plugins/function.html_checkboxes.php - About 2 hrs to fix

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

                        public function yylex3()
                        {
                            $tokenMap = array (
                                  1 => 0,
                                  2 => 0,
                    Severity: Major
                    Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language