CORE-POS/Common-Bundle

View on GitHub

Showing 1,039 of 1,039 total issues

The class SqliteAdapter has 19 public methods. Consider refactoring SqliteAdapter to keep number of public methods under 10.
Open

class SqliteAdapter implements DialectAdapter
{
    public function createNamedDB($name)
    {
        return 'SELECT 1';
Severity: Minor
Found in src/sql/SqliteAdapter.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

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

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

                  public function load()
                  {
                      if (empty($this->unique)) {
                          return false;
                      }
              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 updateRecord has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function updateRecord()
                  {
                      $sql = 'UPDATE '.$this->fq_name;
                      $sets = '';
                      $where = '1=1';
              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 save has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function save()
                  {
                      if (!is_array($this->hooks) || empty($this->hooks)) {
                          $this->loadHooks();
                      }
              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 writeLog has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function writeLog($message, array $context, $intLevel)
                  {
                      $file = $this->getLogLocation($intLevel);
                      $verboseDebug = $this->verboseDebugging();
              
              
              Severity: Minor
              Found in src/BaseLogger.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 __call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __call($name, $arguments)
                  {
                      if (!isset($this->columns[$name])) {
                          foreach ($this->columns as $col => $info) {
                              if (isset($info['replaces']) && $info['replaces'] == $name) {
              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 create has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function create()
                  {
                      if ($this->connection->tableExists($this->fq_name)) {
                          return true;
                      }
              Severity: Minor
              Found in src/BasicModel.php - About 1 hr to fix

                Function arrayToSQL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function arrayToSQL($definition, $dbms)
                    {
                        $sql = '';
                        $type = $definition['type'];
                        if (isset($this->meta_types[strtoupper($type)])) {
                Severity: Minor
                Found in src/BasicModel.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 normalizeColumnAttributes has 46 lines of code (exceeds 25 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 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language