samsonos/php_activerecord

View on GitHub
src/dbMySQLConnector.php

Summary

Maintainability
F
4 days
Test Coverage

Function classes has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    public function classes($class_data, $class_name, $table_name = NULL, array $db_relations = NULL)
    {
        // Сюда соберем код для генерации классов ActiveRecord
        $class_eval = '';

Severity: Minor
Found in src/dbMySQLConnector.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

Method classes has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function classes($class_data, $class_name, $table_name = NULL, array $db_relations = NULL)
    {
        // Сюда соберем код для генерации классов ActiveRecord
        $class_eval = '';

Severity: Major
Found in src/dbMySQLConnector.php - About 5 hrs to fix

    Function relations has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function relations($cachePath = '')
        {
            // Generate unique file name
            $relations_file = $cachePath . '/relations/' . md5(serialize(TableRelation::$instances)) . '.php';
    
    
    Severity: Minor
    Found in src/dbMySQLConnector.php - About 5 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 dbMySQLConnector.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php 
    namespace samson\activerecord;
    
    use samsonframework\orm\Database;
    use samson\core\File;
    Severity: Minor
    Found in src/dbMySQLConnector.php - About 2 hrs to fix

      Method relations has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function relations($cachePath = '')
          {
              // Generate unique file name
              $relations_file = $cachePath . '/relations/' . md5(serialize(TableRelation::$instances)) . '.php';
      
      
      Severity: Major
      Found in src/dbMySQLConnector.php - About 2 hrs to fix

        Method generate has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function generate($force = false, $cachePath = '')
            {
                // Processed permanent table relations
                $db_relations = array();
        
        
        Severity: Major
        Found in src/dbMySQLConnector.php - About 2 hrs to fix

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

              public function generate($force = false, $cachePath = '')
              {
                  // Processed permanent table relations
                  $db_relations = array();
          
          
          Severity: Minor
          Found in src/dbMySQLConnector.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 __build_columns_map has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private function __build_columns_map($table_name, array & $select = array(), array & $map = array(), array & $alias = array(), $alias_table_name = null)
          Severity: Minor
          Found in src/dbMySQLConnector.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status