symphonycms/symphony-2

View on GitHub
symphony/content/content.blueprintsevents.php

Summary

Maintainability
F
1 wk
Test Coverage

Function __form has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    public function __form($readonly = false)
    {
        $formHasErrors = (is_array($this->_errors) && !empty($this->_errors));

        if ($formHasErrors) {
Severity: Minor
Found in symphony/content/content.blueprintsevents.php - About 1 day 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 __form has 256 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __form($readonly = false)
    {
        $formHasErrors = (is_array($this->_errors) && !empty($this->_errors));

        if ($formHasErrors) {
Severity: Major
Found in symphony/content/content.blueprintsevents.php - About 1 day to fix

    File content.blueprintsevents.php has 501 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @package content
     */
    
    
    Severity: Major
    Found in symphony/content/content.blueprintsevents.php - About 1 day to fix

      Function __formAction has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __formAction()
          {
              $fields = $_POST['fields'];
              $this->_errors = array();
              $providers = Symphony::ExtensionManager()->getProvidersOf(iProvider::EVENT);
      Severity: Minor
      Found in symphony/content/content.blueprintsevents.php - About 7 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 __formAction has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __formAction()
          {
              $fields = $_POST['fields'];
              $this->_errors = array();
              $providers = Symphony::ExtensionManager()->getProvidersOf(iProvider::EVENT);
      Severity: Major
      Found in symphony/content/content.blueprintsevents.php - About 5 hrs to fix

        Method __actionEdit has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __actionEdit()
            {
                if (array_key_exists('save', $_POST['action'])) {
                    return $this->__formAction();
                } elseif (array_key_exists('delete', $_POST['action'])) {
        Severity: Minor
        Found in symphony/content/content.blueprintsevents.php - About 1 hr to fix

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

              public function __actionEdit()
              {
                  if (array_key_exists('save', $_POST['action'])) {
                      return $this->__formAction();
                  } elseif (array_key_exists('delete', $_POST['action'])) {
          Severity: Minor
          Found in symphony/content/content.blueprintsevents.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 __injectAboutInformation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __injectAboutInformation(&$shell, $details)
              {
                  if (!is_array($details) || empty($details)) {
                      return;
                  }
          Severity: Minor
          Found in symphony/content/content.blueprintsevents.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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  } elseif (array_key_exists('delete', $_POST['action'])) {
                      /**
                       * Prior to deleting the Event file. Target file path is provided.
                       *
                       * @delegate EventPreDelete
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 1 day to fix
          symphony/content/content.blueprintsdatasources.php on lines 1118..1169

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 296.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                  if ($formHasErrors) {
                      $this->pageAlert(
                          __('An error occurred while processing this form. See below for details.'),
                          Alert::ERROR
                      );
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 2 other locations - About 5 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 36..63
          symphony/content/content.blueprintssections.php on lines 357..384

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 189.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function __viewIndex($resource_type)
              {
                  parent::__viewIndex(ResourceManager::RESOURCE_TYPE_EVENT);
          
                  $this->setTitle(__('%1$s &ndash; %2$s', array(__('Events'), __('Symphony'))));
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 2 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 13..19

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 136.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (trim($fields['name']) == '') {
                      $this->_errors['name'] = __('This is a required field');
                  } elseif (strpos($fields['name'], '\\') !== false) {
                      $this->_errors['name'] = __('This field contains invalid characters') . ' (\\)';
                  } elseif (!preg_match('/^\p{L}/u', $fields['name'])) {
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 2 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 1186..1192

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($this->_context['action'] === 'new' && is_file($file)) {
                      $isDuplicate = true;
                  } elseif ($this->_context['action'] === 'edit') {
                      $existing_handle = $this->_context['handle'];
          
          
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 2 hrs to fix
          symphony/content/content.blueprintsdatasources.php on lines 1251..1261

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 123.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public function __injectAboutInformation(&$shell, $details)
              {
                  if (!is_array($details) || empty($details)) {
                      return;
                  }
          Severity: Major
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 1 hr to fix
          symphony/content/content.blueprintsdatasources.php on lines 1571..1584

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 118.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($isEditing) {
                      $button = new XMLElement('button', __('Delete'));
                      $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this event'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this event?')));
                      $div->appendChild($button);
                  }
          Severity: Minor
          Found in symphony/content/content.blueprintsevents.php and 1 other location - About 35 mins to fix
          symphony/content/content.blueprintsdatasources.php on lines 1009..1013

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 92.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status