symphonycms/symphony-2

View on GitHub
symphony/lib/toolkit/events/class.event.section.php

Summary

Maintainability
F
3 days
Test Coverage

Function processSendMailFilter has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
    {
        $fields['recipient']        = self::replaceFieldToken($send_email['recipient'], $fields);
        $fields['recipient']        = preg_split('/\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
        $fields['recipient']        = array_map('trim', $fields['recipient']);
Severity: Minor
Found in symphony/lib/toolkit/events/class.event.section.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 execute has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute()
    {
        if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) {
            $this->eParamFILTERS = array();
        }
Severity: Minor
Found in symphony/lib/toolkit/events/class.event.section.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 processSendMailFilter has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
    {
        $fields['recipient']        = self::replaceFieldToken($send_email['recipient'], $fields);
        $fields['recipient']        = preg_split('/\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
        $fields['recipient']        = array_map('trim', $fields['recipient']);
Severity: Major
Found in symphony/lib/toolkit/events/class.event.section.php - About 3 hrs to fix

    Method __doit has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null)
        {
            $post_values = new XMLElement('post-values');
    
            if (!is_array($this->eParamFILTERS)) {
    Severity: Major
    Found in symphony/lib/toolkit/events/class.event.section.php - About 3 hrs to fix

      Function __doit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __doit(array $fields = array(), XMLElement &$result, $position = null, $entry_id = null)
          {
              $post_values = new XMLElement('post-values');
      
              if (!is_array($this->eParamFILTERS)) {
      Severity: Minor
      Found in symphony/lib/toolkit/events/class.event.section.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

      File class.event.section.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * @package events
       */
      Severity: Minor
      Found in symphony/lib/toolkit/events/class.event.section.php - About 2 hrs to fix

        Method execute has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute()
            {
                if (!isset($this->eParamFILTERS) || !is_array($this->eParamFILTERS)) {
                    $this->eParamFILTERS = array();
                }
        Severity: Minor
        Found in symphony/lib/toolkit/events/class.event.section.php - About 1 hr to fix

          Function appendErrors has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function appendErrors(XMLElement $result, array $fields, $errors, $post_values)
              {
                  $result->setAttribute('result', 'error');
                  $result->appendChild(new XMLElement('message', __('Entry encountered errors when saving.'), array(
                      'message-id' => EventMessages::ENTRY_ERRORS
          Severity: Minor
          Found in symphony/lib/toolkit/events/class.event.section.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

          Function replaceFieldToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true)
              {
                  if (preg_match('/^(fields\[[^\]]+\],?)+$/i', $needle)) {
                      $parts = preg_split('/\,/i', $needle, -1, PREG_SPLIT_NO_EMPTY);
                      $parts = array_map('trim', $parts);
          Severity: Minor
          Found in symphony/lib/toolkit/events/class.event.section.php - About 55 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 processSendMailFilter has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
          Severity: Minor
          Found in symphony/lib/toolkit/events/class.event.section.php - About 35 mins to fix

            Method replaceFieldToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function replaceFieldToken($needle, $haystack, $default = null, $discard_field_name = true, $collapse = true)
            Severity: Minor
            Found in symphony/lib/toolkit/events/class.event.section.php - About 35 mins to fix

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in symphony/lib/toolkit/events/class.event.section.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return true;
                Severity: Major
                Found in symphony/lib/toolkit/events/class.event.section.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return false;
                  Severity: Major
                  Found in symphony/lib/toolkit/events/class.event.section.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status