MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

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

  public function createPayout($account_id=NULL, $strToken) {
    $stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id) VALUES (?)");
    if ($stmt && $stmt->bind_param('i', $account_id) && $stmt->execute()) {
      $insert_id = $stmt->insert_id;
      // twofactor - consume the token if it is enabled and valid
Severity: Minor
Found in include/classes/payout.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 getPPSValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  public function getPPSValue() {
    // Fetch RPC difficulty
    if ($this->bitcoin->can_connect() === true) {
      $dDifficulty = $this->bitcoin->getdifficulty();
    } else {
Severity: Minor
Found in include/classes/statistics.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 detachSigner has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function detachSigner(Swift_Signer $signer)
    {
        if ($signer instanceof Swift_Signers_HeaderSigner) {
            foreach ($this->headerSigners as $k => $headerSigner) {
                if ($headerSigner === $signer) {
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Message.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 _createParameter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

        $encoded = false;

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

    public function stop()
    {
        if ($this->_started) {
            if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {
                $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');

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 getSubTemplate has 35 lines of code (exceeds 25 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

    Method sendInvitation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function sendInvitation($account_id, $aData) {
        $this->debug->append("STA " . __METHOD__, 4);
        // Check data input
        if (empty($aData['email']) || !filter_var($aData['email'], FILTER_VALIDATE_EMAIL)) {
          $this->setErrorMessage($this->getErrorMsg('E0023'));
    Severity: Minor
    Found in include/classes/invitation.class.php - About 1 hr to fix

      Method encodeByteStream has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
          {
              if ($maxLineLength > 76 || $maxLineLength <= 0) {
                  $maxLineLength = 76;
              }

        Method filter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function filter($buffer, $_minReplaces = -1)
            {
                if ($this->_treeMaxLen == 0) {
                    return $buffer;
                }

          Method setHeaders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setHeaders(Swift_Mime_HeaderSet $headers)
              {
                  $bodyLen = $this->_bodyLen;
                  if (is_bool($bodyLen)) {
                      $bodyLen = - 1;
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Signers/OpenDKIMSigner.php - About 1 hr to fix

            Function init has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    value: function init() {
                      var self = this;
                      $(this._element).find('li.' + this._config.activeClass).has('ul').children('ul').attr('aria-expanded', true).addClass(this._config.collapseClass + ' ' + this._config.collapseInClass);
            
                      $(this._element).find('li').not('.' + this._config.activeClass).has('ul').children('ul').attr('aria-expanded', false).addClass(this._config.collapseClass);

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

                  public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
                  {
                      $_is_muted_directory = false;
              
                      // add the SMARTY_DIR to the list of muted directories
              Severity: Minor
              Found in include/smarty/libs/Smarty.class.php - About 1 hr to fix

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

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

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

                      public function yy_reduce($yyruleno)
                      {
                          $yymsp = $this->yystack[$this->yyidx];
                          if ($this->yyTraceFILE && $yyruleno >= 0
                                && $yyruleno < count(self::$yyRuleName)) {
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 1 hr to fix

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

                        public function yy_reduce($yyruleno)
                        {
                            $yymsp = $this->yystack[$this->yyidx];
                            if ($this->yyTraceFILE && $yyruleno >= 0
                                  && $yyruleno < count(self::$yyRuleName)) {
                    Severity: Minor
                    Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.php - About 1 hr to fix

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

                          public function compile($args, $compiler, $parameter, $tag, $method)
                          {
                              if (!isset($tag[5]) || substr($tag, -5) != 'close') {
                                  // opening tag of block plugin
                                  // check and get attributes

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

                          public function initResetPassword($username) {
                            $this->debug->append("STA " . __METHOD__, 4);
                            // Fetch the users mail address
                            if (empty($username)) {
                              $this->setErrorMessage("Username must not be empty");
                        Severity: Minor
                        Found in include/classes/user.class.php - About 1 hr to fix

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

                              public function init()
                              {
                                  if (count(self::$_map) > 0) {
                                      return;
                                  }

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

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

                                      public function getNotificatorInstance($notificator, $data){
                                          $class = null;
                                          $file = null;
                                          
                                          if (is_array($notificator)){
                              Severity: Minor
                              Found in include/classes/pushnotification.class.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language