CORE-POS/IS4C

View on GitHub
fannie/item/likecodes/LikeCodeAjax.php

Summary

Maintainability
D
1 day
Test Coverage
F
59%

File LikeCodeAjax.php has 382 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2009 Whole Foods Co-op

Severity: Minor
Found in fannie/item/likecodes/LikeCodeAjax.php - About 5 hrs to fix

    Method get_id_handler has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_id_handler()
        {
            $dbc = $this->connection;
            $dbc->selectDB($this->config->get('OP_DB'));
    
    
    Severity: Major
    Found in fannie/item/likecodes/LikeCodeAjax.php - About 4 hrs to fix

      Method post_id_storeID_inUse_handler has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function post_id_storeID_inUse_handler()
          {
              $newVal = $this->toggleStoreField($this->storeID, $this->id, 'inUse');
              if ($this->connection->tableExists('RpOrderItems')) {
                  if ($newVal == 0) {
      Severity: Minor
      Found in fannie/item/likecodes/LikeCodeAjax.php - About 1 hr to fix

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

            private function getSignOpts()
            {
                $mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
                $enabled = $this->config->get('ENABLED_SIGNAGE');
                if (count($enabled) > 0) {
        Severity: Minor
        Found in fannie/item/likecodes/LikeCodeAjax.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 post_id_storeID_inUse_handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function post_id_storeID_inUse_handler()
            {
                $newVal = $this->toggleStoreField($this->storeID, $this->id, 'inUse');
                if ($this->connection->tableExists('RpOrderItems')) {
                    if ($newVal == 0) {
        Severity: Minor
        Found in fannie/item/likecodes/LikeCodeAjax.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 get_id_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function get_id_handler()
            {
                $dbc = $this->connection;
                $dbc->selectDB($this->config->get('OP_DB'));
        
        
        Severity: Minor
        Found in fannie/item/likecodes/LikeCodeAjax.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

        There are no issues that match your filters.

        Category
        Status