MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

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

    Method getPlugin has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getPlugin($plugin_name, $plugin_type)
        {
            $function = null;
            if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
                if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {

      Method getWorkers has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public function getWorkers($account_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 fetchAllUserMiningStats has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public function fetchAllUserMiningStats($interval=180) {
            $this->debug->append("STA " . __METHOD__, 4);
            $stmt = $this->mysqli->prepare("
              SELECT
                a.id AS id,
        Severity: Minor
        Found in include/classes/statistics.class.php - About 1 hr to fix

          Method smarty_mb_wordwrap has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function smarty_mb_wordwrap($str, $width=75, $break="\n", $cut=false)
              {
                  // break words into tokens using white space as a delimiter
                  $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
                  $length = 0;
          Severity: Minor
          Found in include/smarty/libs/plugins/shared.mb_wordwrap.php - About 1 hr to fix

            Method getUserMiningStats has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public function getUserMiningStats($username, $account_id=NULL, $interval=180) {
                $this->debug->append("STA " . __METHOD__, 4);
                // Dual-caching, try statistics cron first, then fallback to local, then fallbock to SQL
                if ($this->getGetCache() && $data = $this->memcache->getStatic(STATISTICS_ALL_USER_HASHRATES)) {
                  if (array_key_exists($account_id, $data['data'])) {
            Severity: Minor
            Found in include/classes/statistics.class.php - About 1 hr to fix

              Method addSignature has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addSignature(Swift_Mime_HeaderSet $headers)
                  {
                      // Prepare the DKIM-Signature
                      $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector);
                      if ($this->_bodyCanon != 'simple') {
              Severity: Minor
              Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 1 hr to fix

                Function trigger_template_error has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function trigger_template_error($args = null, $line = null)
                    {
                        // get template source line which has error
                        if (!isset($line)) {
                            $line = $this->lex->line;

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

                    public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
                    {
                        // test if allowed methodes callable
                        if (!empty($allowed)) {
                            foreach ((array) $allowed as $method) {
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.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 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function compile($args, $compiler, $parameter)
                    {
                        // check and get attributes
                        $_attr = $this->getAttributes($compiler, $args);
                        $this->openTag($compiler, 'if', array(1, $compiler->nocache));
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_compile_if.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 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function compile($args, $compiler, $parameter)
                    {
                        // check and get attributes
                        $_attr = $this->getAttributes($compiler, $args);
                        $this->openTag($compiler, 'while', $compiler->nocache);
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_compile_while.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_r9 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    function yy_r9(){
                    if ($this->php_handling == Smarty::PHP_PASSTHRU) {
                        $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
                    } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
                        $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
                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 getSubTemplate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)
                    {
                        // already in template cache?
                        if ($this->smarty->allow_ambiguous_resources) {
                            $_templateId = Smarty_Resource::getUniqueTemplateName($this, $template) . $cache_id . $compile_id;
                Severity: Minor
                Found in include/smarty/libs/sysplugins/smarty_internal_template.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 13 (exceeds 5 allowed). Consider refactoring.
                Open

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

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

                  public function log($strType, $strMessage) {
                    // Logmask, we add some infos into the KLogger
                    $strMask = "[ %12s ] [ %8s | %-8s ] [ %7.7s ] : %s";
                    $strIPAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown';
                    $strPage = isset($_REQUEST['page']) ? $_REQUEST['page'] : 'none';
                Severity: Minor
                Found in include/classes/logger.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 check_acl_access has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function check_acl_access($params, $smarty)
                {
                  $isAuthenticated = isset($_SESSION['AUTHENTICATED']) ? true : false;
                  $iAclSetting = $params['acl'];
                  // $params['icon'] is deprecated, only needed for mpos compatibility
                Severity: Minor
                Found in include/lib/smarty_plugins/function.acl.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 connect has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function connect()
                    {
                        if (isset($this->_connection)) {
                            $this->_connection->connect();
                        } else {

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

                    protected function encodeEmailAddress($addr) {
                    #
                    #    Input: an email address, e.g. "foo@example.com"
                    #
                    #    Output: the email address as a mailto link, with each character
                Severity: Minor
                Found in include/lib/Michelf/Markdown.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

                Method getAllUserShares has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public function getAllUserShares() {
                    $this->debug->append("STA " . __METHOD__, 4);
                    if (! $data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) {
                      $data['share_id'] = 0;
                      $data['data'] = array();
                Severity: Minor
                Found in include/classes/statistics.class.php - About 1 hr to fix

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

                      public function send(Swift_Mime_Message $message, &$failedRecipients = null)
                      {
                          $sent = 0;
                          $failedRecipients = (array) $failedRecipients;
                  
                  
                    Severity
                    Category
                    Status
                    Source
                    Language