CORE-POS/Common-Bundle

View on GitHub

Showing 84 of 1,039 total issues

File BasicModel.php has 1065 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Major
Found in src/BasicModel.php - About 2 days to fix

    File SQLManager.php has 1032 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2009 Whole Foods Co-op
    
    
    Severity: Major
    Found in src/SQLManager.php - About 2 days to fix

      SQLManager has 91 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SQLManager 
      {
          private $QUERY_LOG; 
      
          /** Array of connections **/
      Severity: Major
      Found in src/SQLManager.php - About 1 day to fix

        Function normalize has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

            public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
            {
                if ($mode != BasicModel::NORMALIZE_MODE_CHECK && $mode != BasicModel::NORMALIZE_MODE_APPLY) {
                    echo "Error: Unknown mode ($mode)\n";
                    return false;
        Severity: Minor
        Found in src/BasicModel.php - About 1 day 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

        BasicModel has 51 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class BasicModel 
        {
            /**
              Name of the table
            */
        Severity: Major
        Found in src/BasicModel.php - About 7 hrs to fix

          CorePage has 35 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CorePage 
          {
              public $description = "
              Base class for creating HTML pages.
              ";
          Severity: Minor
          Found in src/ui/CorePage.php - About 4 hrs to fix

            Method normalize has 110 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                {
                    if ($mode != BasicModel::NORMALIZE_MODE_CHECK && $mode != BasicModel::NORMALIZE_MODE_APPLY) {
                        echo "Error: Unknown mode ($mode)\n";
                        return false;
            Severity: Major
            Found in src/BasicModel.php - About 4 hrs to fix

              Function find has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function find($sort='', $reverse=false)
                  {
                      if (!is_array($sort)) {
                          $sort = array($sort);
                      }
              Severity: Minor
              Found in src/BasicModel.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

              Function cli has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function cli($argc, $argv)
                  {
                      if ($argc > 2 && $argv[1] == '--doc') {
                          array_shift($argv);
                          array_shift($argv);
              Severity: Minor
              Found in src/BasicModel.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

              Function normalizeColumnAttributes has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function normalizeColumnAttributes($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                  {
                      $current = $this->connection->detailedDefinition($this->name);
                      $recase_columns = array();
                      $redo_pk = false;
              Severity: Minor
              Found in src/BasicModel.php - About 3 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

              Function insertRecord has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function insertRecord()
                  {
                      $sql = 'INSERT INTO '.$this->fq_name;
                      $cols = '(';
                      $vals = '(';
              Severity: Minor
              Found in src/BasicModel.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

              Function create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function create()
                  {
                      if ($this->connection->tableExists($this->fq_name)) {
                          return true;
                      }
              Severity: Minor
              Found in src/BasicModel.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 cli has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function cli($argc, $argv)
                  {
                      if ($argc > 2 && $argv[1] == '--doc') {
                          array_shift($argv);
                          array_shift($argv);
              Severity: Major
              Found in src/BasicModel.php - About 2 hrs to fix

                Function readRoutes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function readRoutes()
                    {
                        // routes begin with method
                        $this->__method = $this->detectMethod();
                
                
                Severity: Minor
                Found in src/ui/CoreRESTfulRouter.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 find has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function find($sort='', $reverse=false)
                    {
                        if (!is_array($sort)) {
                            $sort = array($sort);
                        }
                Severity: Major
                Found in src/BasicModel.php - About 2 hrs to fix

                  PgsqlAdapter has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class PgsqlAdapter implements DialectAdapter
                  {
                      public function createNamedDB($name)
                      {
                          return 'CREATE SCHEMA ' . $this->identifierEscape($name);
                  Severity: Minor
                  Found in src/sql/PgsqlAdapter.php - About 2 hrs to fix

                    MysqlAdapter has 22 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class MysqlAdapter implements DialectAdapter
                    {
                        public function createNamedDB($name)
                        {
                            return 'CREATE DATABASE ' . $this->identifierEscape($name);
                    Severity: Minor
                    Found in src/sql/MysqlAdapter.php - About 2 hrs to fix

                      SqliteAdapter has 22 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class SqliteAdapter implements DialectAdapter
                      {
                          public function createNamedDB($name)
                          {
                              return 'SELECT 1';
                      Severity: Minor
                      Found in src/sql/SqliteAdapter.php - About 2 hrs to fix

                        MssqlAdapter has 22 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class MssqlAdapter implements DialectAdapter
                        {
                            public function createNamedDB($name)
                            {
                                return 'CREATE DATABASE ' . $this->identifierEscape($name);
                        Severity: Minor
                        Found in src/sql/MssqlAdapter.php - About 2 hrs to fix

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

                              private function normalizeRename($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
                              {
                                  $current = $this->connection->detailedDefinition($this->name);
                                  $recase_columns = array();
                                  foreach ($this->columns as $col_name => $definition) {
                          Severity: Minor
                          Found in src/BasicModel.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

                          Severity
                          Category
                          Status
                          Source
                          Language