MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Function isTrustedPHPDir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function isTrustedPHPDir($filepath)
    {
        if (empty($this->trusted_dir)) {
            throw new SmartyException("directory '{$filepath}' not allowed by security setting (no trusted_dir specified)");
        }
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_security.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 normalizePath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function normalizePath($_path, $ds=true)
    {
        if ($ds) {
            // don't we all just love windows?
            $_path = str_replace('\\', '/', $_path);
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_resource.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 isTokenValid has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  public function isTokenValid($account_id, $token, $type, $checkTimeExplicitly=false) {
    if (!is_int($account_id) || !is_int($type)) {
      $this->setErrorMessage("Invalid token");
      return 0;
    }
Severity: Minor
Found in include/classes/token.class.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 getReaderFor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getReaderFor($charset)
    {
        $charset = trim(strtolower($charset));
        foreach (self::$_map as $pattern => $spec) {
            $re = '/^' . $pattern . '$/D';

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

    protected function si2bin($si, $bits = 32)
    {
        $bin = null;
        if ($si >= -pow(2, $bits - 1) && ($si <= pow(2, $bits - 1))) {
            // positive or zero

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

  public function getTransactionSummary($account_id=NULL) {
    if ($data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data;
    $sql = "
      SELECT
        SUM(t.amount) AS total, t.type AS type
Severity: Minor
Found in include/classes/transaction.class.php - About 1 hr to fix

    Method sendChangeConfigEmail has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function sendChangeConfigEmail($strType, $userID) {
        $exists = $this->token->doesTokenExist($strType, $userID);
        if ($exists == 0) {
          $token = $this->token->createToken($strType, $userID);
          $aData['token'] = $token;
    Severity: Minor
    Found in include/classes/user.class.php - About 1 hr to fix

      Method smarty_function_html_options_optoutput has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
      {
          if (!is_array($value)) {
              $_key = smarty_function_escape_special_chars($key);
              $_html_result = '<option value="' . $_key . '"';
      Severity: Minor
      Found in include/smarty/libs/plugins/function.html_options.php - About 1 hr to fix

        Method yy_shift has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function yy_shift($yyNewState, $yyMajor, $yypMinor)
            {
                $this->yyidx++;
                if ($this->yyidx >= self::YYSTACKDEPTH) {
                    $this->yyidx--;
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 1 hr to fix

          Method yy_shift has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function yy_shift($yyNewState, $yyMajor, $yypMinor)
              {
                  $this->yyidx++;
                  if ($this->yyidx >= self::YYSTACKDEPTH) {
                      $this->yyidx--;
          Severity: Minor
          Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 1 hr to fix

            Method listInvalidationKeys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
                {
                    $t = array('IVK#ALL');
                    $_name = $_compile = '#';
                    if ($resource_name) {

              Method bind_param has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public function bind_param($paramTypes) {
                  if (!is_string($paramTypes)) {
                    return false;
                  } else {
                    $args = func_get_args();
              Severity: Minor
              Found in include/classes/strict.class.php - About 1 hr to fix

                Method getMPQueue has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public function getMPQueue($limit=250) {
                    $stmt = $this->mysqli->prepare("
                      SELECT
                      a.id,
                      a.username,
                Severity: Minor
                Found in include/classes/transaction.class.php - About 1 hr to fix

                  Method smarty_mb_str_replace has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function smarty_mb_str_replace($search, $replace, $subject, &$count=0)
                      {
                          if (!is_array($search) && is_array($replace)) {
                              return false;
                          }
                  Severity: Minor
                  Found in include/smarty/libs/plugins/shared.mb_str_replace.php - About 1 hr to fix

                    Function cookie has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var config = $.cookie = function (key, value, options) {
                    
                            // Write
                    
                            if (value !== undefined && !$.isFunction(value)) {
                    Severity: Minor
                    Found in public/site_assets/bootstrap/js/jquery.cookie.js - About 1 hr to fix

                      Method smarty_modifier_date_format has 29 lines of code (exceeds 25 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 1 hr to fix

                        Method smarty_modifier_capitalize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
                        {
                            if (Smarty::$_MBSTRING) {
                                if ($lc_rest) {
                                    // uppercase (including hyphenated words)
                        Severity: Minor
                        Found in include/smarty/libs/plugins/modifier.capitalize.php - About 1 hr to fix

                          Method compileTemplateSource has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function compileTemplateSource()
                              {
                                  if (!$this->source->recompiled) {
                                      $this->properties['file_dependency'] = array();
                                      if ($this->source->components) {
                          Severity: Minor
                          Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 1 hr to fix

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

                                public function compile($args, $compiler)
                                {
                                    // check and get attributes
                                    $_attr = $this->getAttributes($compiler, $args);
                                    $_name = trim($_attr['name'], "\"'");
                            Severity: Minor
                            Found in include/smarty/libs/sysplugins/smarty_internal_compile_block.php - About 1 hr to fix

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

                                  public function __construct($main, $slave = false, $strict = false)
                                  {
                                      if ($strict) {
                                          $this->mysqliW = new mysqli_strict($main['host'],
                                              $main['user'], $main['pass'],
                              Severity: Minor
                              Found in include/classes/mysqlims.class.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language