MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

Method doDefLists has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doDefLists($text) {
    #
    # Form HTML definition lists.
    #
        $less_than_tab = $this->tab_width - 1;
Severity: Minor
Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

    Method encodeString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
        {
            if ($maxLineLength > 76 || $maxLineLength <= 0) {
                $maxLineLength = 76;
            }
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Encoder/QpEncoder.php - About 1 hr to fix

      Method _appendFootnotes_callback has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _appendFootnotes_callback($matches) {
              $node_id = $this->fn_id_prefix . $matches[1];
              
              # Create footnote marker only if it has a corresponding footnote *and*
              # the footnote hasn't been used by another marker.
      Severity: Minor
      Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                        if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
                            && (!isset($resource_name)
                                || (isset($_filepath[$_resource_part_1_length])
                                    && substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
                                || (isset($_filepath[$_resource_part_2_length])
        Severity: Critical
        Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if ($this->properties['version'] != Smarty::SMARTY_VERSION) {
                      $is_valid = false;
                  } elseif (((!$cache && $this->smarty->compile_check && empty($this->compiled->_properties) && !$this->compiled->isCompiled) || $cache && ($this->smarty->compile_check === true || $this->smarty->compile_check === Smarty::COMPILECHECK_ON)) && !empty($this->properties['file_dependency'])) {
                      foreach ($this->properties['file_dependency'] as $_file_to_check) {
                          if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'php') {
          Severity: Critical
          Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

            if ($config['twofactor']['enabled'] && $user->isAuthenticated()) {
              // set the token to be the old token, just in case an error occured
              $ea_token = (@$oldtoken_ea !== '') ? $oldtoken_ea : @$ea_token;
              $wf_token = (@$oldtoken_wf !== '') ? $oldtoken_wf : @$wf_token;
              $cp_token = (@$oldtoken_cp !== '') ? $oldtoken_cp : @$cp_token;
            Severity: Critical
            Found in include/pages/account/edit.inc.php - About 1 hr to fix

              Method getPluginFromDefaultHandler has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPluginFromDefaultHandler($tag, $plugin_type)
                  {
                      $callback = null;
                      $script = null;
                      $cacheable = true;

                Method populate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
                        {
                            $_source_file_path = str_replace(':', '.', $_template->source->filepath);
                            $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
                            $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;

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

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

                        public function compile($args, $compiler, $parameter, $tag)
                        {
                            // This tag does create output
                            $compiler->has_output = true;
                            // check and get attributes

                      Method getAllIdleWorkers has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method createDebitRecord has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          private function createDebitRecord($account_id, $coin_address, $amount, $type) {
                            // Calculate and deduct txfee from amount
                            $type == 'Debit_MP' ? $txfee = $this->config['txfee_manual'] : $txfee = $this->config['txfee_auto'];
                            $amount = $amount - $txfee;
                            // Add Debit record
                        Severity: Minor
                        Found in include/classes/transaction.class.php - About 1 hr to fix

                          Method processDefListItems has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function processDefListItems($list_str) {
                              #
                              #    Process the contents of a single definition list, splitting it
                              #    into individual term and definition list items.
                              #
                          Severity: Minor
                          Found in include/lib/Michelf/Markdown.php - About 1 hr to fix

                            Method getTemplateVars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
                                {
                                    if (isset($varname)) {
                                        $_var = $this->getVariable($varname, $_ptr, $search_parents, false);
                                        if (is_object($_var)) {
                            Severity: Minor
                            Found in include/smarty/libs/sysplugins/smarty_internal_data.php - About 1 hr to fix

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

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

                                Method yy_r154 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function yy_r154(){
                                    if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {
                                        if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) {
                                            $func_name = strtolower($this->yystack[$this->yyidx + -3]->minor);
                                            if ($func_name == 'isset') {
                                Severity: Minor
                                Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 1 hr to fix

                                  Method getUserEstimates has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    public function getUserEstimates($value1, $value2, $dDonate, $bNoFees, $ppsvalue=0) {
                                      $this->debug->append("STA " . __METHOD__, 4);
                                      if ($this->config['payout_system'] != 'pps') {
                                        if (@$value1['valid'] > 0  && @$value2['valid'] > 0) {
                                          $this->config['reward_type'] == 'fixed' ? $reward = $this->config['reward'] : $reward = $this->block->getAverageAmount();
                                  Severity: Minor
                                  Found in include/classes/statistics.class.php - About 1 hr to fix

                                    Method sendNotification has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      public function sendNotification($account_id, $strType, $aMailData) {
                                        // Check if we notified for this event already
                                        if ( $this->isNotified($aMailData) ) {
                                          $this->setErrorMessage('A notification for this event has been sent already');
                                          return false;
                                    Severity: Minor
                                    Found in include/classes/notification.class.php - About 1 hr to fix

                                      Method flushQueue has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
                                          {
                                              $directoryIterator = new DirectoryIterator($this->_path);
                                      
                                              /* Start the transport only if there are queued files to send */
                                      Severity: Minor
                                      Found in include/lib/swiftmailer/classes/Swift/FileSpool.php - About 1 hr to fix

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

                                            public function addAutoloadFilters($filters, $type=null)
                                            {
                                                if ($type !== null) {
                                                    if (!empty($this->autoload_filters[$type])) {
                                                        $this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);
                                        Severity: Minor
                                        Found in include/smarty/libs/Smarty.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language