MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Smarty_Internal_TemplateBase has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
{
    /**
     * fetches a rendered Smarty template
     *
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 2 hrs to fix

    Method send has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function send(Swift_Mime_Message $message, &$failedRecipients = null)
        {
            $failedRecipients = (array) $failedRecipients;
    
            if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
    Severity: Major
    Found in include/lib/swiftmailer/classes/Swift/Transport/MailTransport.php - About 2 hrs to fix

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

          public function yypopstate()
          {
             if ($this->yyTraceFILE) {
                   fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,  isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
              }
      include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php on lines 75..85

      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 134.

      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

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

          public function yypopstate()
          {
             if ($this->yyTraceFILE) {
                   fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,  isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
              }
      include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 124..134

      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 134.

      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 dateFormat has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var dateFormat = function () {
          var    token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
              timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
              timezoneClip = /[^-+\dA-Z]/g,
              pad = function (val, len) {
      Severity: Major
      Found in public/site_assets/bootstrap/js/plugins/date.format.js - About 2 hrs to fix

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

            public function compile($args, $compiler)
            {
                // check and get attributes
                $_attr = $this->getAttributes($compiler, $args);
        
        
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_section.php - About 2 hrs to fix

          Function smarty_function_html_radios_output has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
          {
              $_output = '';
          
              if (is_object($value)) {
          Severity: Minor
          Found in include/smarty/libs/plugins/function.html_radios.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 mutingErrorHandler has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
              {
                  $_is_muted_directory = false;
          
                  // add the SMARTY_DIR to the list of muted directories
          Severity: Minor
          Found in include/smarty/libs/Smarty.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 runFilter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function runFilter($type, $content, Smarty_Internal_Template $template)
              {
                  $output = $content;
                  // loop over autoload filters of specified type
                  if (!empty($template->smarty->autoload_filters[$type])) {
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_filter_handler.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 isTrustedResourceDir has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function isTrustedResourceDir($filepath)
              {
                  $_template = false;
                  $_config = false;
                  $_secure = false;
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_security.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 getClasses has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

                  public function getClasses(){
                      if (self::$classes === null){
                          $directory = new DirectoryIterator(__DIR__.'/push_notification');
                          foreach ($directory as $fileInfo) {
                              if (($fileInfo->getExtension() != 'php') || $fileInfo->isDot()) {
          Severity: Minor
          Found in include/classes/pushnotification.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 getAllUserStats has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            public function getAllUserStats($filter='%',$limit=1,$start=0) {
              $this->debug->append("STA " . __METHOD__, 4);
              $sql = "
                SELECT
                  a.id AS id,
          Severity: Minor
          Found in include/classes/statistics.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 streamToMime has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
              {
                  $bufferLength = 78;
                  $headerData = '';
          
          
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Signers/SMimeSigner.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 setChildren has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setChildren(array $children, $compoundLevel = null)
              {
                  // TODO: Try to refactor this logic
          
                  $compoundLevel = isset($compoundLevel)
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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

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

              function yy_r6_1($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1356..1365
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1366..1375

          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 133.

          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

              function yy_r1_5($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_TEXT;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 230..238

          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 133.

          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 3 locations. Consider refactoring.
          Open

              function yy_r6_2($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1346..1355
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1366..1375

          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 133.

          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

              function yy_r1_4($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
              $this->token = Smarty_Internal_Templateparser::TP_TEXT;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 239..247

          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 133.

          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 3 locations. Consider refactoring.
          Open

              function yy_r6_3($yy_subpatterns)
              {
          
            if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) {
               $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1346..1355
          include/smarty/libs/sysplugins/smarty_internal_templatelexer.php on lines 1356..1365

          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 133.

          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

                              if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
                                  $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;
                                  $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;
                              } else {
                                  $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;
          include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on lines 610..616

          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 132.

          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

          Severity
          Category
          Status
          Source
          Language