modxcms/revolution

View on GitHub
core/model/modx/mail/modphpmailer.class.php

Summary

Maintainability
D
1 day
Test Coverage

Function set has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($key, $value) {
        parent :: set($key, $value);
        switch ($key) {
            case modMail::MAIL_BODY :
                $this->mailer->Body= $this->attributes[$key];
Severity: Minor
Found in core/model/modx/mail/modphpmailer.class.php - About 5 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 set has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set($key, $value) {
        parent :: set($key, $value);
        switch ($key) {
            case modMail::MAIL_BODY :
                $this->mailer->Body= $this->attributes[$key];
Severity: Major
Found in core/model/modx/mail/modphpmailer.class.php - About 4 hrs to fix

    Function _getMailer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _getMailer() {
            $success = false;
            if (!$this->mailer || !($this->mailer instanceof PHPMailer\PHPMailer\PHPMailer)) {
                if ($this->mailer = new PHPMailer\PHPMailer\PHPMailer()) {
                    if (!empty($this->attributes)) {
    Severity: Minor
    Found in core/model/modx/mail/modphpmailer.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 address has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function address($type, $email, $name= '') {
            $set= false;
            if ($email) {
                $set= parent :: address($type, $email, $name);
                if ($set) {
    Severity: Minor
    Found in core/model/modx/mail/modphpmailer.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

    Method address has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function address($type, $email, $name= '') {
            $set= false;
            if ($email) {
                $set= parent :: address($type, $email, $name);
                if ($set) {
    Severity: Minor
    Found in core/model/modx/mail/modphpmailer.class.php - About 1 hr to fix

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

          public function embedImage($image, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
      Severity: Minor
      Found in core/model/modx/mail/modphpmailer.class.php - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status