piotrpolak/pepiscms

View on GitHub
pepiscms/application/libraries/EmailSender.php

Summary

Maintainability
C
1 day
Test Coverage

Function send has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function send($to, $from, $from_name, $subject, $message,
                         $html = false, $attachments = array(), $reply_to = false, $reply_to_name = false)
    {
        if (!$html) {
            $message = str_replace("\r\n", "\n", $message);
Severity: Minor
Found in pepiscms/application/libraries/EmailSender.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

Method send has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function send($to, $from, $from_name, $subject, $message,
                         $html = false, $attachments = array(), $reply_to = false, $reply_to_name = false)
    {
        if (!$html) {
            $message = str_replace("\r\n", "\n", $message);
Severity: Major
Found in pepiscms/application/libraries/EmailSender.php - About 2 hrs to fix

    Method send has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function send($to, $from, $from_name, $subject, $message,
                             $html = false, $attachments = array(), $reply_to = false, $reply_to_name = false)
    Severity: Major
    Found in pepiscms/application/libraries/EmailSender.php - About 1 hr to fix

      Method sendSystemTemplate has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function sendSystemTemplate($to, $from, $from_name, $subject, $email_template_name,
                                             $data = array(), $html = false, $language = false, $attachments = array())
      Severity: Major
      Found in pepiscms/application/libraries/EmailSender.php - About 1 hr to fix

        Method sendTemplate has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function sendTemplate($to, $from, $from_name, $subject, $email_template_path,
                                         $data = array(), $html = false, $attachments = array())
        Severity: Major
        Found in pepiscms/application/libraries/EmailSender.php - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status