MPOS/php-mpos

View on GitHub
include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();
        $this->_restoreMessage($message);
        $to = array_keys($message->getTo());
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.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

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

    private function _restoreMessage(Swift_Mime_Message $message)
    {
        if ($this->_lastMessage === $message) {
            if (isset($this->_originalBody)) {
                $message->setBody($this->_originalBody);
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.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 beforeSendPerformed has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();
        $this->_restoreMessage($message);
        $to = array_keys($message->getTo());
Severity: Major
Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php - About 2 hrs to fix

    There are no issues that match your filters.

    Category
    Status