CaffGeek/MBACNationals

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

Summary

Maintainability
F
1 wk
Test Coverage

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

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

    Function Data has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      function Data($msg_data) {
        $this->error = null; # so no confusion is caused
    
        if(!$this->connected()) {
          $this->error = array(
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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 Data has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function Data($msg_data) {
        $this->error = null; # so no confusion is caused
    
        if(!$this->connected()) {
          $this->error = array(
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 4 hrs to fix

      SMTP has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SMTP
      {
        /**
         *  SMTP server port
         *  @var int
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 2 hrs to fix

        Method Authenticate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function Authenticate($username, $password) {
            // Start authentication
            fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
        
            $rply = $this->get_lines();
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 1 hr to fix

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

            function Connect($host,$port=0,$tval=30) {
              # set the error val to null so there is no confusion
              $this->error = null;
          
              # make sure we are __not__ connected
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 1 hr to fix

            Method Quit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function Quit($close_on_error=true) {
                $this->error = null; # so there is no confusion
            
                if(!$this->connected()) {
                  $this->error = array(
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 1 hr to fix

              Method Expand has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function Expand($name) {
                  $this->error = null; # so no confusion is caused
              
                  if(!$this->connected()) {
                    $this->error = array(
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 1 hr to fix

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

                  function Help($keyword="") {
                    $this->error = null; # to avoid confusion
                
                    if(!$this->connected()) {
                      $this->error = array(
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php - About 1 hr to fix

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

                    function Authenticate($username, $password) {
                      // Start authentication
                      fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
                  
                      $rply = $this->get_lines();
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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 get_lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    function get_lines() {
                      $data = "";
                      while($str = @fgets($this->smtp_conn,515)) {
                        if($this->do_debug >= 4) {
                          echo "SMTP -> get_lines(): \$data was \"$data\"" .
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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

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

                    function Connect($host,$port=0,$tval=30) {
                      # set the error val to null so there is no confusion
                      $this->error = null;
                  
                      # make sure we are __not__ connected
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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 Help has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    function Help($keyword="") {
                      $this->error = null; # to avoid confusion
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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 Quit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    function Quit($close_on_error=true) {
                      $this->error = null; # so there is no confusion
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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 Verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    function Verify($name) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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

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

                    function Recipient($to) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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

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

                    function Connected() {
                      if(!empty($this->smtp_conn)) {
                        $sock_status = socket_get_status($this->smtp_conn);
                        if($sock_status["eof"]) {
                          # hmm this is an odd situation... the socket is
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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

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

                    function Expand($name) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function SendOrMail($from) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 2 other locations - About 7 hrs to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 831..861
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 879..909

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 224.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function SendAndMail($from) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 2 other locations - About 7 hrs to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 831..861
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 927..957

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 224.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    function Send($from) {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 2 other locations - About 7 hrs to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 879..909
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 927..957

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 224.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    function Noop() {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 1 other location - About 6 hrs to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 782..813

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 216.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    function Reset() {
                      $this->error = null; # so no confusion is caused
                  
                      if(!$this->connected()) {
                        $this->error = array(
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 1 other location - About 6 hrs to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 641..671

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 216.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      if($code != 211 && $code != 214) {
                        $this->error =
                          array("error" => "HELP not accepted from server",
                                "smtp_code" => $code,
                                "smtp_msg" => substr($rply,4));
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 1 other location - About 45 mins to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 756..766

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 96.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      if($code != 250 && $code != 251) {
                        $this->error =
                          array("error" => "RCPT not accepted from server",
                                "smtp_code" => $code,
                                "smtp_msg" => substr($rply,4));
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-smtp.php and 1 other location - About 45 mins to fix
                  Web.Admin/2014/wordpress/wp-includes/class-smtp.php on lines 569..579

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 96.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status