MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Smarty_Internal_Templatelexer has 121 functions (exceeds 20 allowed). Consider refactoring.
Open

class Smarty_Internal_Templatelexer
{
    public $data;
    public $counter;
    public $token;
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 2 days to fix

    Function smarty_function_html_select_date has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

    function smarty_function_html_select_date($params, $template)
    {
        // generate timestamps used for month names only
        static $_month_timestamps = null;
        static $_current_year = null;
    Severity: Minor
    Found in include/smarty/libs/plugins/function.html_select_date.php - About 2 days 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 getApiType has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
    Open

      private function getApiType($url) {
        if (preg_match('/coinchoose.com/', $url)) {
          return 'coinchoose';
        } else if (preg_match('/btc-e.nz/', $url)) {
          return 'btce';
    Severity: Minor
    Found in include/classes/tools.class.php - About 2 days 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 2 locations. Consider refactoring.
    Open

        if ($display_seconds) {
            $_html_seconds = '';
            $_extra = '';
            $_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
            if ($all_extra) {
    Severity: Major
    Found in include/smarty/libs/plugins/function.html_select_time.php and 1 other location - About 2 days to fix
    include/smarty/libs/plugins/function.html_select_time.php on lines 242..279

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

    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 ($display_minutes) {
            $_html_minutes = '';
            $_extra = '';
            $_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
            if ($all_extra) {
    Severity: Major
    Found in include/smarty/libs/plugins/function.html_select_time.php and 1 other location - About 2 days to fix
    include/smarty/libs/plugins/function.html_select_time.php on lines 282..319

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

    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 (is_array($parameter['if condition'])) {
                if ($compiler->nocache) {
                    $_nocache = ',true';
                    // create nocache var to make it know for further compiling
                    if (is_array($parameter['if condition']['var'])) {
    include/smarty/libs/sysplugins/smarty_internal_compile_if.php on lines 40..63

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

    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 (is_array($parameter['if condition'])) {
                if ($compiler->nocache) {
                    $_nocache = ',true';
                    // create nocache var to make it know for further compiling
                    if (is_array($parameter['if condition']['var'])) {
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_compile_if.php and 1 other location - About 2 days to fix
    include/smarty/libs/sysplugins/smarty_internal_compile_while.php on lines 40..63

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

    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 ($smarty->getConfigDir() as $config_dir) {
                $_config_dir = $config_dir;
                $config_dir = realpath($config_dir);
                // resolve include_path or fail existence
                if (!$config_dir) {
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
    include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 308..372

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

    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 ($smarty->getTemplateDir() as $template_dir) {
                $_template_dir = $template_dir;
                $template_dir = realpath($template_dir);
                // resolve include_path or fail existence
                if (!$template_dir) {
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_utility.php and 1 other location - About 1 day to fix
    include/smarty/libs/sysplugins/smarty_internal_utility.php on lines 557..621

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

    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

    File user.class.php has 805 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
    
    class User extends Base {
      protected $table = 'accounts';
    Severity: Major
    Found in include/classes/user.class.php - About 1 day to fix

      Function clear has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
      Open

              public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
              {
                  $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
                  $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
                  $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php - About 1 day 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

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

          public function yy_reduce($yyruleno)
          {
              $yymsp = $this->yystack[$this->yyidx];
              if ($this->yyTraceFILE && $yyruleno >= 0
                    && $yyruleno < count(self::$yyRuleName)) {
      include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 762..801

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

      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 yy_reduce($yyruleno)
          {
              $yymsp = $this->yystack[$this->yyidx];
              if ($this->yyTraceFILE && $yyruleno >= 0
                    && $yyruleno < count(self::$yyRuleName)) {
      include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 3079..3118

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

      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

      Consider simplifying this complex logical expression.
      Open

              if (
                  // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1)
                  $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)>=4.3 ||
                  $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)>=3.1 ||
                  $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)>=3.1 ||
      Severity: Critical
      Found in include/lib/Mobile_Detect.php - About 1 day to fix

        Function smarty_function_html_select_time has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
        Open

        function smarty_function_html_select_time($params, $template)
        {
            $prefix = "Time_";
            $field_array = null;
            $field_separator = "\n";
        Severity: Minor
        Found in include/smarty/libs/plugins/function.html_select_time.php - About 1 day 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 88 (exceeds 5 allowed). Consider refactoring.
        Open

            public function compile($args, $compiler, $parameter)
            {
                // check and get attributes
                $_attr = $this->getAttributes($compiler, $args);
                // save posible attributes
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_include.php - About 1 day 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 87 (exceeds 5 allowed). Consider refactoring.
        Open

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

        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 smarty_internal_configfileparser.php has 745 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
        * Smarty Internal Plugin Configfileparser
        *
        * This is the config file parser.
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 1 day to fix

          File statistics.class.php has 720 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
          
          
          /*
          Severity: Major
          Found in include/classes/statistics.class.php - About 1 day to fix

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

            class TP_yyToken implements ArrayAccess
            {
                public $string = '';
                public $metadata = array();
            
            
            include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 12..75

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

            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