CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/FannieCRUDPage.php

Summary

Maintainability
D
1 day
Test Coverage
F
49%

Method get_view has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_view()
    {
        $obj = $this->getCRUDModel();
        $id_col = $this->getIdCol();
        $columns = $obj->getColumns();
Severity: Major
Found in fannie/classlib2.0/FannieCRUDPage.php - About 3 hrs to fix

    Function get_view has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_view()
        {
            $obj = $this->getCRUDModel();
            $id_col = $this->getIdCol();
            $columns = $obj->getColumns();
    Severity: Minor
    Found in fannie/classlib2.0/FannieCRUDPage.php - About 2 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

    File FannieCRUDPage.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2015 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/classlib2.0/FannieCRUDPage.php - About 2 hrs to fix

      Method post_id_handler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function post_id_handler()
          {
              if (!is_array($this->id)) {
                  return $this->unknownRequestHandler();
              }
      Severity: Minor
      Found in fannie/classlib2.0/FannieCRUDPage.php - About 1 hr to fix

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

            protected function getCRUDModel()
            {
                if ($this->model === null) {
                    $class_name = $this->model_name;
                    $this->model = new $class_name($this->connection);
        Severity: Minor
        Found in fannie/classlib2.0/FannieCRUDPage.php - About 1 hr to fix

          Function put_handler has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function put_handler()
              {
                  $obj = $this->getCRUDModel();
                  $id_col = $this->getIdCol();
                  $columns = $obj->getColumns();
          Severity: Minor
          Found in fannie/classlib2.0/FannieCRUDPage.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 put_handler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function put_handler()
              {
                  $obj = $this->getCRUDModel();
                  $id_col = $this->getIdCol();
                  $columns = $obj->getColumns();
          Severity: Minor
          Found in fannie/classlib2.0/FannieCRUDPage.php - About 1 hr to fix

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

                protected function getCRUDModel()
                {
                    if ($this->model === null) {
                        $class_name = $this->model_name;
                        $this->model = new $class_name($this->connection);
            Severity: Minor
            Found in fannie/classlib2.0/FannieCRUDPage.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 getIdCol has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getIdCol()
                {
                    $pks = array();
                    $obj = $this->getCRUDModel();
                    foreach ($obj->getColumns() as $name => $c) {
            Severity: Minor
            Found in fannie/classlib2.0/FannieCRUDPage.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

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

                protected function findPlaceholder($columns, $id_col)
                {
                    foreach ($columns as $col_name => $c) {
                        if ($col_name != $id_col && strstr(strtoupper($c['type']), 'CHAR')) {
                            return array($col_name, 'NEW');
            Severity: Minor
            Found in fannie/classlib2.0/FannieCRUDPage.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

            Function post_id_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function post_id_handler()
                {
                    if (!is_array($this->id)) {
                        return $this->unknownRequestHandler();
                    }
            Severity: Minor
            Found in fannie/classlib2.0/FannieCRUDPage.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