arastta/arastta

View on GitHub
admin/controller/common/menu.php

Summary

Maintainability
F
2 wks
Test Coverage

Method index has 845 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function index($data) {
        $this->load->language('common/menu');

        $data = $this->language->all($data);

Severity: Major
Found in admin/controller/common/menu.php - About 4 days to fix

    File menu.php has 911 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @package     Arastta eCommerce
     * @copyright   2015-2017 Arastta Association. All rights reserved.
     * @copyright   See CREDITS.txt for credits and other copyright notices.
    Severity: Major
    Found in admin/controller/common/menu.php - About 2 days to fix

      Function addMenuItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addMenuItem ($id, $text, $href = '', $parent_id = '', $permission = true, $icon = '', $sort_order = 0, $position = 'left') {
              $new_item = array(
                  'text'       => $text,
                  'href'       => $href,
                  'permission' => $permission,
      Severity: Minor
      Found in admin/controller/common/menu.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 removeMenuItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function removeMenuItem($id, $parent_id = '') {
              if ($parent_id) {
                  if (isset($this->menu[$parent_id])) {
                      unset($this->menu[$parent_id]['children'][$id]);
                  } else {
      Severity: Minor
      Found in admin/controller/common/menu.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 index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function index($data) {
              $this->load->language('common/menu');
      
              $data = $this->language->all($data);
      
      
      Severity: Minor
      Found in admin/controller/common/menu.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 addMenuItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function addMenuItem ($id, $text, $href = '', $parent_id = '', $permission = true, $icon = '', $sort_order = 0, $position = 'left') {
      Severity: Major
      Found in admin/controller/common/menu.php - About 1 hr to fix

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

                $this->menu['appearance']['children'] = array(
                    'theme' => array(
                        'text' => $data['text_theme'],
                        'href' => $this->url->link('appearance/theme', 'token=' . $this->session->data['token'], 'SSL'),
                        'sort_order' => 1,
        Severity: Major
        Found in admin/controller/common/menu.php and 3 other locations - About 1 day to fix
        admin/controller/common/menu.php on lines 302..333
        admin/controller/common/menu.php on lines 593..624
        admin/controller/common/menu.php on lines 627..658

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

        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 4 locations. Consider refactoring.
        Open

                $this->menu['extension']['children'] = array(
                    'modification' => array(
                        'text' => $data['text_modification'],
                        'href' => $this->url->link('extension/modification', 'token=' . $this->session->data['token'], 'SSL'),
                        'sort_order' => 1,
        Severity: Major
        Found in admin/controller/common/menu.php and 3 other locations - About 1 day to fix
        admin/controller/common/menu.php on lines 302..333
        admin/controller/common/menu.php on lines 559..590
        admin/controller/common/menu.php on lines 627..658

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

        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 4 locations. Consider refactoring.
        Open

                $this->menu['sale']['children'] = array(
                    'order' => array(
                        'text' => $data['text_order'],
                        'href' => $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL'),
                        'sort_order' => 1,
        Severity: Major
        Found in admin/controller/common/menu.php and 3 other locations - About 1 day to fix
        admin/controller/common/menu.php on lines 559..590
        admin/controller/common/menu.php on lines 593..624
        admin/controller/common/menu.php on lines 627..658

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

        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 4 locations. Consider refactoring.
        Open

                $this->menu['marketplace']['children'] = array(
                    'theme' => array(
                        'text' => $data['text_theme'],
                        'href' => $this->url->link('extension/marketplace', 'store=themes&token=' . $this->session->data['token'], 'SSL'),
                        'sort_order' => 1,
        Severity: Major
        Found in admin/controller/common/menu.php and 3 other locations - About 1 day to fix
        admin/controller/common/menu.php on lines 302..333
        admin/controller/common/menu.php on lines 559..590
        admin/controller/common/menu.php on lines 593..624

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

        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

                    'returns' => array(
                        'text' => $data['text_return'],
                        'sort_order' => 5,
                        'permission' => $p_return_return_status || $p_return_return_action || $p_return_return_reason,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 1 other location - About 6 hrs to fix
        admin/controller/common/menu.php on lines 531..555

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

        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

                    'marketing' => array(
                        'text' => $data['text_marketing'],
                        'sort_order' => 4,
                        'permission' => $p_return_report_marketing || $p_return_report_affiliate || $p_return_report_affiliate_activity,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 1 other location - About 6 hrs to fix
        admin/controller/common/menu.php on lines 686..710

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

        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

                    'taxes' => array(
                        'text' => $data['text_tax'],
                        'sort_order' => 9,
                        'permission' => $p_return_tax_rate || $p_return_tax_class,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 2 other locations - About 3 hrs to fix
        admin/controller/common/menu.php on lines 250..268
        admin/controller/common/menu.php on lines 469..487

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

        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

                    'attribute' => array(
                        'text' => $data['text_attribute'],
                        'sort_order' => 5,
                        'permission' => $p_return_attribute || $p_return_attribute_group,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 2 other locations - About 3 hrs to fix
        admin/controller/common/menu.php on lines 469..487
        admin/controller/common/menu.php on lines 729..747

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

        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

                    'products' => array(
                        'text' => $data['text_product'],
                        'sort_order' => 2,
                        'permission' => $p_return_product_viewed || $p_return_product_purchased,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 2 other locations - About 3 hrs to fix
        admin/controller/common/menu.php on lines 250..268
        admin/controller/common/menu.php on lines 729..747

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

        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

                    'users' => array(
                        'text' => $data['text_users'],
                        'sort_order' => 4,
                        'permission' => $p_return_user || $p_return_user_permission,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 1 other location - About 2 hrs to fix
        admin/controller/common/menu.php on lines 383..399

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

        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

                    'gift_vouchers' => array(
                        'text' => $data['text_voucher'],
                        'sort_order' => 4,
                        'permission' => $p_return_voucher || $p_return_voucher_theme,
                        'children' => array(
        Severity: Major
        Found in admin/controller/common/menu.php and 1 other location - About 2 hrs to fix
        admin/controller/common/menu.php on lines 782..798

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

        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