Showing 25 of 25 total issues

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

    public static function addContent($request, $match)
    {
        $tt = Pluf_Shortcuts_GetObjectOr404('CMS_TermTaxonomy', $match['parentId']);
        $content = NULL;
        if (array_key_exists('modelId', $match)) {
Severity: Major
Found in src/CMS/Views/TermTaxonomy.php and 1 other location - About 1 day to fix
src/CMS/Views.php on lines 220..249

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

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 static function addTermTaxonomy($request, $match)
    {
        $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
        $tt = NULL;
        if (array_key_exists('modelId', $match)) {
Severity: Major
Found in src/CMS/Views.php and 1 other location - About 1 day to fix
src/CMS/Views/TermTaxonomy.php on lines 24..53

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

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 static function removeContent($request, $match)
    {
        $tt = Pluf_Shortcuts_GetObjectOr404('CMS_TermTaxonomy', $match['parentId']);
        $content = NULL;
        if (array_key_exists('modelId', $match)) {
Severity: Major
Found in src/CMS/Views/TermTaxonomy.php and 1 other location - About 1 day to fix
src/CMS/Views.php on lines 285..314

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

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 static function removeTermTaxonomy($request, $match)
    {
        $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
        $tt = NULL;
        if (array_key_exists('modelId', $match)) {
Severity: Major
Found in src/CMS/Views.php and 1 other location - About 1 day to fix
src/CMS/Views/TermTaxonomy.php on lines 88..117

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

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 findContents($request, $match)
    {
        $tt = Pluf_Shortcuts_GetObjectOr404('CMS_TermTaxonomy', $match['parentId']);
        $content = new CMS_Content();

Severity: Major
Found in src/CMS/Views/TermTaxonomy.php and 1 other location - About 6 hrs to fix
src/CMS/Views.php on lines 258..283

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

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 findTermTaxonomies($request, $match)
    {
        $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
        $tt = new CMS_TermTaxonomy();
        
Severity: Major
Found in src/CMS/Views.php and 1 other location - About 6 hrs to fix
src/CMS/Views/TermTaxonomy.php on lines 62..86

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

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

Method init has 167 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function init()
    {
        $this->_a['table'] = 'cms_contents';
        $this->_a['cols'] = array(
            // Identifier
Severity: Major
Found in src/CMS/Content.php - About 6 hrs to fix

    Method init has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function init()
        {
            $this->_a['table'] = 'cms_content_histories';
            $this->_a['verbose'] = 'CMS Content History';
            $this->_a['cols'] = array(
    Severity: Major
    Found in src/CMS/ContentHistory.php - About 3 hrs to fix

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

      function CMS_Shortcuts_GetTermBySlugOr404($slug)
      {
          $q = new Pluf_SQL('slug=%s', array(
              $slug
          ));
      Severity: Major
      Found in src/CMS/Shortcuts.php and 1 other location - About 3 hrs to fix
      src/CMS/Shortcuts.php on lines 28..45

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

      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

      function CMS_Shortcuts_GetNamedContentOr404($name)
      {
          $q = new Pluf_SQL('name=%s', array(
              $name
          ));
      Severity: Major
      Found in src/CMS/Shortcuts.php and 1 other location - About 3 hrs to fix
      src/CMS/Shortcuts.php on lines 54..71

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

      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

      Method init has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function init()
          {
              $this->_a['table'] = 'cms_term_taxonomy';
              $this->_a['verbose'] = 'CMS_TermTaxonomy';
              $this->_a['cols'] = array(
      Severity: Major
      Found in src/CMS/TermTaxonomy.php - About 2 hrs to fix

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

        <?php
        /*
         * This file is part of Pluf Framework, a simple PHP Application Framework.
         * Copyright (C) 2010-2020 Phoinex Scholars Co. (http://dpq.co.ir)
         *
        Severity: Minor
        Found in src6/urls/content.php - About 2 hrs to fix

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

              public static function addMember($request, $match)
              {
                  $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
                  if (isset($match['modelId'])) {
                      $userId = $match['modelId'];
          Severity: Major
          Found in src/CMS/Views/ContentMember.php and 1 other location - About 1 hr to fix
          src/CMS/Views/ContentMember.php on lines 55..66

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

          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 static function removeMember($request, $match)
              {
                  $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['parentId']);
                  if (isset($match['modelId'])) {
                      $userId = $match['modelId'];
          Severity: Major
          Found in src/CMS/Views/ContentMember.php and 1 other location - About 1 hr to fix
          src/CMS/Views/ContentMember.php on lines 42..53

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

          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 delete($request, $match)
              {
                  // تعیین داده‌ها
                  $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['modelId']);
                  // بررسی دسترسی‌ها
          Severity: Major
          Found in src/CMS/Views.php and 1 other location - About 1 hr to fix
          src/CMS/Views.php on lines 92..106

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

          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 update($request, $match)
              {
                  // تعیین داده‌ها
                  $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['modelId']);
                  // بررسی دسترسی‌ها
          Severity: Major
          Found in src/CMS/Views.php and 1 other location - About 1 hr to fix
          src/CMS/Views.php on lines 116..130

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

          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

          Method find has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function find($request, $match)
              {
                  if (isset($match['name'])) {
                      $content = CMS_Shortcuts_GetNamedContentOr404($match['name']);
                  } else {
          Severity: Minor
          Found in src/CMS/Views/ContentHistory.php - About 1 hr to fix

            Method init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init()
                {
                    $this->_a['table'] = 'cms_term_metas';
                    $this->_a['cols'] = array(
                        // Identifier
            Severity: Minor
            Found in src/CMS/TermMeta.php - About 1 hr to fix

              Method init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function init()
                  {
                      $this->_a['table'] = 'cms_content_metas';
                      $this->_a['cols'] = array(
                          // Identifier
              Severity: Minor
              Found in src/CMS/ContentMeta.php - About 1 hr to fix

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

                    function save($commit = true)
                    {
                        $model = parent::save(false);
                        // update the content
                        if (array_key_exists('file', $this->cleaned_data)) {
                Severity: Minor
                Found in src/CMS/Form/ContentUpdate.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

                Severity
                Category
                Status
                Source
                Language