MPOS/php-mpos

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

Summary

Maintainability
D
3 days
Test Coverage

File SimpleMimeEntity.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of SwiftMailer.
 * (c) 2004-2009 Chris Corbyn
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 7 hrs to fix

    Swift_Mime_SimpleMimeEntity has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
    {
        /** A collection of Headers for this mime entity */
        private $_headers;
    
    
    Severity: Major
    Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 7 hrs to fix

      Function _bodyToByteStream has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _bodyToByteStream(Swift_InputByteStream $is)
          {
              if (empty($this->_immediateChildren)) {
                  if (isset($this->_body)) {
                      if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
      Severity: Minor
      Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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

      Function setChildren has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setChildren(array $children, $compoundLevel = null)
          {
              // TODO: Try to refactor this logic
      
              $compoundLevel = isset($compoundLevel)
      Severity: Minor
      Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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 setChildren has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setChildren(array $children, $compoundLevel = null)
          {
              // TODO: Try to refactor this logic
      
              $compoundLevel = isset($compoundLevel)
      Severity: Minor
      Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 1 hr to fix

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

            protected function _bodyToByteStream(Swift_InputByteStream $is)
            {
                if (empty($this->_immediateChildren)) {
                    if (isset($this->_body)) {
                        if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
        Severity: Minor
        Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php - About 1 hr to fix

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

              protected function _bodyToString()
              {
                  $string = '';
          
                  if (isset($this->_body) && empty($this->_immediateChildren)) {
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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 _getNeededChildLevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _getNeededChildLevel($child, $compoundLevel)
              {
                  $filter = array();
                  foreach ($this->_compoundLevelFilters as $bitmask => $rules) {
                      if (($compoundLevel & $bitmask) === $bitmask) {
          Severity: Minor
          Found in include/lib/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.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

          There are no issues that match your filters.

          Category
          Status