mambax7/xnewsletter

View on GitHub
include/phpmailer_bmh/class.phpmailer-bmh.php

Summary

Maintainability
F
4 days
Test Coverage

Function processMailbox has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    public function processMailbox($max = false)
    {
        if (empty($this->action_function) || !function_exists($this->action_function)) {
            $this->error_msg = 'Action function not found!';
            $this->output();
Severity: Minor
Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 1 day 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

File class.phpmailer-bmh.php has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* class.phpmailer-bmh.php
.---------------------------------------------------------------------------.
|  Software: PHPMailer-BMH (Bounce Mail Handler)                            |
|   Version: 5.0.0rc1                                                       |
Severity: Minor
Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 5 hrs to fix

    Method processMailbox has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function processMailbox($max = false)
        {
            if (empty($this->action_function) || !function_exists($this->action_function)) {
                $this->error_msg = 'Action function not found!';
                $this->output();
    Severity: Major
    Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 4 hrs to fix

      Method processBounce has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function processBounce($pos, $type, $totalFetched)
          {
              $header  = imap_headerinfo($this->_mailbox_link, $pos);
              $subject = strip_tags($header->subject);
              if ('DSN' === $type) {
      Severity: Major
      Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 3 hrs to fix

        Function processBounce has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processBounce($pos, $type, $totalFetched)
            {
                $header  = imap_headerinfo($this->_mailbox_link, $pos);
                $subject = strip_tags($header->subject);
                if ('DSN' === $type) {
        Severity: Minor
        Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 3 hrs 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 globalDelete has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function globalDelete()
            {
                $dateArr = explode('-', $this->deleteMsgDate); // date format is yyyy-mm-dd
                $delDate = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]);
        
        
        Severity: Minor
        Found in include/phpmailer_bmh/class.phpmailer-bmh.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 mailbox_exist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function mailbox_exist($mailbox, $create = true)
            {
                if ('' == trim($mailbox) || false === mb_strpos($mailbox, 'INBOX.')) {
                    // this is a critical error with either the mailbox name blank or an invalid mailbox name
                    // need to stop processing and exit at this point
        Severity: Minor
        Found in include/phpmailer_bmh/class.phpmailer-bmh.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 globalDelete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function globalDelete()
            {
                $dateArr = explode('-', $this->deleteMsgDate); // date format is yyyy-mm-dd
                $delDate = mktime(0, 0, 0, $dateArr[1], $dateArr[2], $dateArr[0]);
        
        
        Severity: Minor
        Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 1 hr to fix

          Method mailbox_exist has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function mailbox_exist($mailbox, $create = true)
              {
                  if ('' == trim($mailbox) || false === mb_strpos($mailbox, 'INBOX.')) {
                      // this is a critical error with either the mailbox name blank or an invalid mailbox name
                      // need to stop processing and exit at this point
          Severity: Minor
          Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 1 hr to fix

            Avoid too many return statements within this method.
            Open

                    return null;
            Severity: Major
            Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 30 mins to fix

              Function isParameter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function isParameter($currParameters, $varKey, $varValue)
                  {
                      foreach ($currParameters as $key => $value) {
                          if ($key == $varKey) {
                              if ($value == $varValue) {
              Severity: Minor
              Found in include/phpmailer_bmh/class.phpmailer-bmh.php - About 25 mins 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

              There are no issues that match your filters.

              Category
              Status