mambax7/xnewsletter

View on GitHub
include/phpmailer/extras/class.html2text.php

Summary

Maintainability
C
1 day
Test Coverage

File class.html2text.php has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*************************************************************************
 *                                                                       *
 * Converts HTML to formatted plain text                                 *
 *                                                                       *
Severity: Minor
Found in include/phpmailer/extras/class.html2text.php - About 3 hrs to fix

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

        protected function _convert_blockquotes(&$text)
        {
            if (preg_match_all('/<\/*blockquote[^>]*>/i', $text, $matches, PREG_OFFSET_CAPTURE)) {
                $start  = 0;
                $taglen = 0;
    Severity: Minor
    Found in include/phpmailer/extras/class.html2text.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 _convert_blockquotes has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _convert_blockquotes(&$text)
        {
            if (preg_match_all('/<\/*blockquote[^>]*>/i', $text, $matches, PREG_OFFSET_CAPTURE)) {
                $start  = 0;
                $taglen = 0;
    Severity: Minor
    Found in include/phpmailer/extras/class.html2text.php - About 1 hr to fix

      Function _build_link_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _build_link_list($link, $display, $link_override = null)
          {
              $link_method = $link_override ?: $this->_options['do_links'];
              if ('none' === $link_method) {
                  return $display;
      Severity: Minor
      Found in include/phpmailer/extras/class.html2text.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 _build_link_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _build_link_list($link, $display, $link_override = null)
          {
              $link_method = $link_override ?: $this->_options['do_links'];
              if ('none' === $link_method) {
                  return $display;
      Severity: Minor
      Found in include/phpmailer/extras/class.html2text.php - About 1 hr to fix

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

            public function set_base_url($url = '')
            {
                if (empty($url)) {
                    if (\Xmf\Request::hasVar('HTTP_HOST', 'SERVER')) {
                        $this->url = 'http://' . $_SERVER['HTTP_HOST'];
        Severity: Minor
        Found in include/phpmailer/extras/class.html2text.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

        Avoid too many return statements within this method.
        Open

                return $display . ' [' . $url . ']';
        Severity: Major
        Found in include/phpmailer/extras/class.html2text.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return '';
          Severity: Major
          Found in include/phpmailer/extras/class.html2text.php - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status