symphonycms/symphony-2

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

Summary

Maintainability
F
1 wk
Test Coverage

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

    public function __actionEdit()
    {
        if ($this->_context['action'] !== 'new' && !$page_id = $this->_context['id']) {
            redirect(SYMPHONY_URL . '/blueprints/pages/');
        }
Severity: Minor
Found in symphony/content/content.blueprintspages.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

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

<?php

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

    Method __viewEdit has 233 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __viewEdit()
        {
            $this->setPageType('form');
            $fields = array("title"=>null, "handle"=>null, "parent"=>null, "params"=>null, "type"=>null, "data_sources"=>null);
            $existing = $fields;
    Severity: Major
    Found in symphony/content/content.blueprintspages.php - About 1 day to fix

      Function __viewEdit has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __viewEdit()
          {
              $this->setPageType('form');
              $fields = array("title"=>null, "handle"=>null, "parent"=>null, "params"=>null, "type"=>null, "data_sources"=>null);
              $existing = $fields;
      Severity: Minor
      Found in symphony/content/content.blueprintspages.php - About 6 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 __actionEdit has 134 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __actionEdit()
          {
              if ($this->_context['action'] !== 'new' && !$page_id = $this->_context['id']) {
                  redirect(SYMPHONY_URL . '/blueprints/pages/');
              }
      Severity: Major
      Found in symphony/content/content.blueprintspages.php - About 5 hrs to fix

        Method __viewIndex has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __viewIndex()
            {
                $this->setPageType('table');
                $this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));
        
        
        Severity: Major
        Found in symphony/content/content.blueprintspages.php - About 4 hrs to fix

          Function __viewIndex has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __viewIndex()
              {
                  $this->setPageType('table');
                  $this->setTitle(__('%1$s &ndash; %2$s', array(__('Pages'), __('Symphony'))));
          
          
          Severity: Minor
          Found in symphony/content/content.blueprintspages.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 __actionDelete has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __actionDelete($pages, $redirect)
              {
                  $success = true;
                  $deleted_page_ids = array();
          
          
          Severity: Minor
          Found in symphony/content/content.blueprintspages.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 __actionDelete has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __actionDelete($pages, $redirect)
              {
                  $success = true;
                  $deleted_page_ids = array();
          
          
          Severity: Minor
          Found in symphony/content/content.blueprintspages.php - About 1 hr to fix

            Method insertBreadcrumbsUsingPageIdentifier has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function insertBreadcrumbsUsingPageIdentifier($page_id, $preserve_last = true)
                {
                    if ($page_id == 0) {
                        return $this->insertBreadcrumbs(
                            array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/'))
            Severity: Minor
            Found in symphony/content/content.blueprintspages.php - About 1 hr to fix

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

                  public function insertBreadcrumbsUsingPageIdentifier($page_id, $preserve_last = true)
                  {
                      if ($page_id == 0) {
                          return $this->insertBreadcrumbs(
                              array(Widget::Anchor(__('Pages'), SYMPHONY_URL . '/blueprints/pages/'))
              Severity: Minor
              Found in symphony/content/content.blueprintspages.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

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

                  public function parseContext(array &$context, array $parts)
                  {
                      // Order is important!
                      $params = array_fill_keys(array('action', 'id', 'flag'), null);
              
              
              Severity: Major
              Found in symphony/content/content.blueprintspages.php and 1 other location - About 4 hrs to fix
              symphony/content/content.systemauthors.php on lines 25..37

              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 174.

              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 (is_array($datasources) && !empty($datasources)) {
                          if (!isset($fields['data_sources'])) {
                              $fields['data_sources'] = array();
                          }
              
              
              Severity: Minor
              Found in symphony/content/content.blueprintspages.php and 1 other location - About 30 mins to fix
              symphony/content/content.blueprintspages.php on lines 491..501

              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 90.

              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 (is_array($events) && !empty($events)) {
                          if (!isset($fields['events'])) {
                              $fields['events'] = array();
                          }
              
              
              Severity: Minor
              Found in symphony/content/content.blueprintspages.php and 1 other location - About 30 mins to fix
              symphony/content/content.blueprintspages.php on lines 514..524

              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 90.

              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