MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

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

    Method getCharPositions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
        {
            if (!isset($currentMap['i']) || ! isset($currentMap['p'])) {
                $currentMap['p'] = $currentMap['i'] = array();
            }

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

          public function compile($args, $compiler, $parameter)
          {
              if ($parameter == 0) {
                  $this->required_attributes = array('start', 'to');
                  $this->optional_attributes = array('max', 'step');
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_compile_for.php - About 1 hr to fix

        Method __get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __get($property_name)
            {
                switch ($property_name) {
                    case 'source':
                        if (strlen($this->template_resource) == 0) {
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 1 hr to fix

          Method getWorker has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public function getWorker($id, $interval=600) {
              $this->debug->append("STA " . __METHOD__, 4);
              $stmt = $this->mysqli->prepare("
                SELECT id, username, password, monitor,
                  (
          Severity: Minor
          Found in include/classes/worker.class.php - About 1 hr to fix

            Method compile has 36 lines of code (exceeds 25 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) {

              Method writeFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function writeFile($_filepath, $_contents, Smarty $smarty)
                  {
                      $_error_reporting = error_reporting();
                      error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
                      if ($smarty->_file_perms !== null) {
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_internal_write_file.php - About 1 hr to fix

                Method display_debug has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function display_debug($obj)
                    {
                        // prepare information of assigned variables
                        $ptr = self::get_debug_vars($obj);
                        if ($obj instanceof Smarty) {
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_debug.php - About 1 hr to fix

                  Method _createParameter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function _createParameter($name, $value)
                      {
                          $origValue = $value;
                  
                          $encoded = false;

                    Function smarty_function_counter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function smarty_function_counter($params, $template)
                    {
                        static $counters = array();
                    
                        $name = (isset($params['name'])) ? $params['name'] : 'default';
                    Severity: Minor
                    Found in include/smarty/libs/plugins/function.counter.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 compile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function compile($args, $compiler, $parameter)
                        {
                            if ($parameter == 0) {
                                $this->required_attributes = array('start', 'to');
                                $this->optional_attributes = array('max', 'step');
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_compile_for.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 getConfigVars has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getConfigVars($varname = null, $search_parents = true)
                        {
                            $_ptr = $this;
                            $var_array = array();
                            while ($_ptr !== null) {
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_data.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 appendByRef has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function appendByRef($tpl_var, &$value, $merge = false)
                        {
                            if ($tpl_var != '' && isset($value)) {
                                if (!isset($this->tpl_vars[$tpl_var])) {
                                    $this->tpl_vars[$tpl_var] = new Smarty_variable();
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_data.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 yy_find_shift_action has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                       public function yy_find_shift_action($iLookAhead)
                        {
                            $stateno = $this->yystack[$this->yyidx]->stateno;
                    
                            /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.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 yy_find_shift_action has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                       public function yy_find_shift_action($iLookAhead)
                        {
                            $stateno = $this->yystack[$this->yyidx]->stateno;
                    
                            /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 get_debug_vars has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function get_debug_vars($obj)
                        {
                            $config_vars = $obj->config_vars;
                            $tpl_vars = array();
                            foreach ($obj->tpl_vars as $key => $var) {
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_debug.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 addWorker has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public function addWorker($account_id, $workerName, $workerPassword) {
                        $this->debug->append("STA " . __METHOD__, 4);
                        if ('' === $workerName || '' === $workerPassword) {
                          $this->setErrorMessage($this->getErrorMsg('E0058'));
                          return false;
                    Severity: Minor
                    Found in include/classes/worker.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 getTransactionSummary has a Cognitive Complexity of 12 (exceeds 5 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

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

                      public function sendMail($template, $aData, $throttle=false) {
                        // Prepare SMTP transport and mailer
                        $transport_type = $this->config['swiftmailer']['type'];
                        if ($transport_type == 'sendmail') {
                          $transport = Swift_SendmailTransport::newInstance($this->config['swiftmailer'][$transport_type]['path'] . ' ' . $this->config['swiftmailer'][$transport_type]['options']);
                    Severity: Minor
                    Found in include/classes/mail.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 __call has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public function __call($method, $params) {
                        if (!is_scalar($method)) throw new Exception('Method name has no scalar value');
                    
                        if (is_array($params)) {
                          // no keys
                    Severity: Minor
                    Found in include/lib/jsonRPCClient.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

                    Severity
                    Category
                    Status
                    Source
                    Language