Thruio/ActiveRecord

View on GitHub
src/DatabaseLayer/Sql/Postgres.php

Summary

Maintainability
D
2 days
Test Coverage

Function buildTable has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildTable(ActiveRecord $model)
    {
        $schema = $model->getClassSchema();
        $params = array();
        foreach ($model->__calculateSaveDownRows() as $p => $parameter) {
Severity: Minor
Found in src/DatabaseLayer/Sql/Postgres.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

Method buildTable has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildTable(ActiveRecord $model)
    {
        $schema = $model->getClassSchema();
        $params = array();
        foreach ($model->__calculateSaveDownRows() as $p => $parameter) {
Severity: Major
Found in src/DatabaseLayer/Sql/Postgres.php - About 3 hrs to fix

    File Postgres.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace Thru\ActiveRecord\DatabaseLayer\Sql;
    
    use Monolog\Logger;
    use Thru\ActiveRecord\DatabaseLayer;
    Severity: Minor
    Found in src/DatabaseLayer/Sql/Postgres.php - About 2 hrs to fix

      Function processSelect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function processSelect(DatabaseLayer\Select $thing)
          {
              $fields = array();
              $tables = array();
              $orders = array();
      Severity: Minor
      Found in src/DatabaseLayer/Sql/Postgres.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

      Method processSelect has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function processSelect(DatabaseLayer\Select $thing)
          {
              $fields = array();
              $tables = array();
              $orders = array();
      Severity: Major
      Found in src/DatabaseLayer/Sql/Postgres.php - About 2 hrs to fix

        Function processConditions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function processConditions($thing)
            {
                $conditions = [];
                // CONDITIONS
                if (count($thing->getConditions()) > 0) {
        Severity: Minor
        Found in src/DatabaseLayer/Sql/Postgres.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 processUpdate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function processUpdate(DatabaseLayer\Update $thing)
            {
                // SELECTORS
                if (count($thing->getTables()) > 1) {
                    throw new Exception("Active Record Cannot update into more than one table at a time!");
        Severity: Minor
        Found in src/DatabaseLayer/Sql/Postgres.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 processInsert has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function processInsert(DatabaseLayer\Insert $thing)
            {
                // SELECTORS
                if (count($thing->getTables()) > 1) {
                    throw new Exception("Active Record Cannot insert into more than one table at a time!");
        Severity: Minor
        Found in src/DatabaseLayer/Sql/Postgres.php - About 1 hr to fix

          Method processUpdate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function processUpdate(DatabaseLayer\Update $thing)
              {
                  // SELECTORS
                  if (count($thing->getTables()) > 1) {
                      throw new Exception("Active Record Cannot update into more than one table at a time!");
          Severity: Minor
          Found in src/DatabaseLayer/Sql/Postgres.php - About 1 hr to fix

            Method getIndexes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getIndexes($table)
                {
                    if (isset($this->known_indexes[$table])) {
                        return $this->known_indexes[$table];
                    }
            Severity: Minor
            Found in src/DatabaseLayer/Sql/Postgres.php - About 1 hr to fix

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

                  public function processInsert(DatabaseLayer\Insert $thing)
                  {
                      // SELECTORS
                      if (count($thing->getTables()) > 1) {
                          throw new Exception("Active Record Cannot insert into more than one table at a time!");
              Severity: Minor
              Found in src/DatabaseLayer/Sql/Postgres.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

              There are no issues that match your filters.

              Category
              Status