MPOS/php-mpos

View on GitHub
include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php

Summary

Maintainability
B
6 hrs
Test Coverage

Swift_Mime_Headers_AbstractHeader has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
{
    /**
     * The name of this Header.
     *
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php - About 3 hrs to fix

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

        protected function getEncodableWordTokens($string)
        {
            $tokens = array();
    
            $encodedToken = '';
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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 encodeWords has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function encodeWords(Swift_Mime_Header $header, $input, $usedLength = -1)
        {
            $value = '';
    
            $tokens = $this->getEncodableWordTokens($input);
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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 createPhrase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function createPhrase(Swift_Mime_Header $header, $string, $charset, Swift_Mime_HeaderEncoder $encoder = null, $shorten = false)
        {
            // Treat token as exactly what was given
            $phraseStr = $string;
            // If it's not valid
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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 createPhrase has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function createPhrase(Swift_Mime_Header $header, $string, $charset, Swift_Mime_HeaderEncoder $encoder = null, $shorten = false)
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php - About 35 mins to fix

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

          private function _tokensToString(array $tokens)
          {
              $lineCount = 0;
              $headerLines = array();
              $headerLines[] = $this->_name . ': ';
      Severity: Minor
      Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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

      There are no issues that match your filters.

      Category
      Status