samsonos/php_activerecord

View on GitHub

Showing 27 of 27 total issues

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

File dbMySQL.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace samson\activerecord;

use samsonframework\orm\QueryInterface;
use samsonframework\orm\ConditionInterface;
Severity: Minor
Found in src/dbMySQL.php - About 5 hrs to fix

    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 toRecords has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function &toRecords($class_name, array & $response, array $join = array(), array $virtual_fields = array())
          {
              // Сформируем правильное имя класса
              $class_name = strpos($class_name, '\\') !== false ? $class_name : '\\samson\activerecord\\'.$class_name;
      
      
      Severity: Minor
      Found in src/dbMySQL.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

      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 toRecords has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function &toRecords($class_name, array & $response, array $join = array(), array $virtual_fields = array())
            {
                // Сформируем правильное имя класса
                $class_name = strpos($class_name, '\\') !== false ? $class_name : '\\samson\activerecord\\'.$class_name;
        
        
        Severity: Major
        Found in src/dbMySQL.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

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

                protected function prepareSQL($class_name, QueryInterface $query)
                {
                    //elapsed( 'dbMySQL::find() Начало');
                    $params = $this->__get_table_data($class_name);
                    // Получим переменные для запроса
            Severity: Minor
            Found in src/dbMySQL.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 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 __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct( $base_class, $table_name_simple, $relation_class = null, $ignore = false )
                  {                
                      // If table name passed without namespace consider it as activerecord namespace
                      $table_name = \samson\core\AutoLoader::className( $table_name_simple, 'samson\activerecord');
              
              
              Severity: Minor
              Found in src/RelationData.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 parseCondition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function parseCondition($class_name, & $arg)
                  {
                      // Получим переменные для запроса
                      extract($this->__get_table_data($class_name));
              
              
              Severity: Minor
              Found in src/dbMySQL.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 prepareSQL has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function prepareSQL($class_name, QueryInterface $query)
                  {
                      //elapsed( 'dbMySQL::find() Начало');
                      $params = $this->__get_table_data($class_name);
                      // Получим переменные для запроса
              Severity: Minor
              Found in src/dbMySQL.php - About 1 hr to fix

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

                    public function migration($classname, $version_handler)
                    {
                        if (!is_callable($version_handler)) {
                            return e('No version handler is passed', E_SAMSON_ACTIVERECORD_ERROR);
                        }
                Severity: Minor
                Found in src/dbMySQL.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 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 __get_table_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __get_table_data($class_name)
                    {
                        // Remove table prefix
                        $class_name = str_replace(self::$prefix, '', $class_name);
                
                
                Severity: Minor
                Found in src/dbMySQL.php - About 1 hr to fix

                  Method parseCondition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function parseCondition($class_name, & $arg)
                      {
                          // Получим переменные для запроса
                          extract($this->__get_table_data($class_name));
                  
                  
                  Severity: Minor
                  Found in src/dbMySQL.php - About 1 hr to fix

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

                        public function &createObject(
                            $className,
                            $identifier,
                            array & $attributes,
                            array & $dbData,
                    Severity: Minor
                    Found in src/dbMySQL.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct( $p, $c, $pf = null,  $rt = self::T_ONE_TO_ONE, $cf = null, $a = null )
                    Severity: Minor
                    Found in src/TableRelation.php - About 45 mins to fix

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

                          public function createField($object, $table, $field, $type = 'INT')
                          {
                              // Check if db identifier field is configured
                              if (class_exists($table)) {
                                  if (strlen($object->$field)) {
                      Severity: Minor
                      Found in src/dbMySQL.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

                      Severity
                      Category
                      Status
                      Source
                      Language