CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php
/*~ class.phpmailer.php
.---------------------------------------------------------------------------.
|  Software: PHPMailer - PHP email class                                    |
|   Version: 2.0.4                                                          |
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 days to fix

    PHPMailer has 63 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PHPMailer {
    
      /////////////////////////////////////////////////
      // PROPERTIES, PUBLIC
      /////////////////////////////////////////////////
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 day to fix

      Function WrapText has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

        function WrapText($message, $length, $qp_mode = false) {
          $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
          // If utf-8 encoding is used, we will need to make sure we don't
          // split multibyte characters when we wrap
          $is_utf8 = (strtolower($this->CharSet) == "utf-8");
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 7 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 EncodeQP has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

        function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
          $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
          $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
          $eol = "\r\n";
          $escape = '=';
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 4 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

      Method _mime_types has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function _mime_types($ext = '') {
          $mimes = array(
            'ai'    =>  'application/postscript',
            'aif'   =>  'audio/x-aiff',
            'aifc'  =>  'audio/x-aiff',
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 3 hrs to fix

        Function MailSend has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          function MailSend($header, $body) {
        
            $to = '';
            for($i = 0; $i < count($this->to); $i++) {
              if($i != 0) { $to .= ', '; }
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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 MsgHTML has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          function MsgHTML($message,$basedir='') {
            preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
            if(isset($images[2])) {
              foreach($images[2] as $i => $url) {
                // do not change urls for absolute images (thanks to corvuscorax)
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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 SmtpSend has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          function SmtpSend($header, $body) {
            include_once($this->PluginDir . 'class-smtp.php');
            $error = '';
            $bad_rcpt = array();
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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 SmtpConnect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          function SmtpConnect() {
            if($this->smtp == NULL) {
              $this->smtp = new SMTP();
            }
        
        
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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 CreateHeader has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          function CreateHeader() {
            $result = '';
        
            /* Set the boundaries */
            $uniq_id = md5(uniqid(time()));
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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

        Method WrapText has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function WrapText($message, $length, $qp_mode = false) {
            $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
            // If utf-8 encoding is used, we will need to make sure we don't
            // split multibyte characters when we wrap
            $is_utf8 = (strtolower($this->CharSet) == "utf-8");
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 hrs to fix

          Method CreateBody has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function CreateBody() {
              $result = '';
              if ($this->sign_key_file) {
                $result .= $this->GetMailMIME();
              }
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 hrs to fix

            Function CreateBody has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

              function CreateBody() {
                $result = '';
                if ($this->sign_key_file) {
                  $result .= $this->GetMailMIME();
                }
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 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

            Method SmtpSend has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function SmtpSend($header, $body) {
                include_once($this->PluginDir . 'class-smtp.php');
                $error = '';
                $bad_rcpt = array();
            
            
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 hrs to fix

              Method CreateHeader has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function CreateHeader() {
                  $result = '';
              
                  /* Set the boundaries */
                  $uniq_id = md5(uniqid(time()));
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 2 hrs to fix

                Function AttachAll has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  function AttachAll() {
                    /* Return text of body */
                    $mime = array();
                
                    /* Add all attachments */
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.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 EncodeHeader has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  function EncodeHeader ($str, $position = 'text') {
                    $x = 0;
                
                    switch (strtolower($position)) {
                      case 'phrase':
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.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 EncodeHeader has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function EncodeHeader ($str, $position = 'text') {
                    $x = 0;
                
                    switch (strtolower($position)) {
                      case 'phrase':
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

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

                    function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
                      $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
                      $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
                      $eol = "\r\n";
                      $escape = '=';
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

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

                      function AttachAll() {
                        /* Return text of body */
                        $mime = array();
                    
                        /* Add all attachments */
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

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

                        function SmtpConnect() {
                          if($this->smtp == NULL) {
                            $this->smtp = new SMTP();
                          }
                      
                      
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

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

                          function MailSend($header, $body) {
                        
                            $to = '';
                            for($i = 0; $i < count($this->to); $i++) {
                              if($i != 0) { $to .= ', '; }
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

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

                            function Send() {
                              $header = '';
                              $body = '';
                              $result = true;
                          
                          
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

                            Method MsgHTML has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function MsgHTML($message,$basedir='') {
                                preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
                                if(isset($images[2])) {
                                  foreach($images[2] as $i => $url) {
                                    // do not change urls for absolute images (thanks to corvuscorax)
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 1 hr to fix

                              Function SetMessageType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                function SetMessageType() {
                                  if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
                                    $this->message_type = 'plain';
                                  } else {
                                    if(count($this->attachment) > 0) {
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 55 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

                              Function UTF8CharBoundary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                function UTF8CharBoundary($encodedText, $maxLength) {
                                  $foundSplitPos = false;
                                  $lookBack = 3;
                                  while (!$foundSplitPos) {
                                    $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 55 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

                              Function Send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                function Send() {
                                  $header = '';
                                  $body = '';
                                  $result = true;
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 45 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

                              Method AddEmbeddedImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 35 mins to fix

                                Function EncodeString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  function EncodeString ($str, $encoding = 'base64') {
                                    $encoded = '';
                                    switch(strtolower($encoding)) {
                                      case 'base64':
                                        /* chunk_split is found in PHP >= 3.0.6 */
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 35 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

                                Function GetMailMIME has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  function GetMailMIME() {
                                    $result = '';
                                    switch($this->message_type) {
                                      case 'plain':
                                        $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
                                Severity: Minor
                                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 35 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

                                Avoid too many return statements within this method.
                                Open

                                    return true;
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 30 mins to fix

                                  There are no issues that match your filters.

                                  Category
                                  Status