j4mie/idiorm

View on GitHub

Showing 17 of 19 total issues

File idiorm.php has 1239 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

    /**
     *
     * Idiorm
Severity: Major
Found in idiorm.php - About 3 days to fix

    ORM has 152 functions (exceeds 20 allowed). Consider refactoring.
    Open

        class ORM implements ArrayAccess {
    
            // ----------------------- //
            // --- CLASS CONSTANTS --- //
            // ----------------------- //
    Severity: Major
    Found in idiorm.php - About 3 days to fix

      Function save has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

              public function save() {
                  $query = array();
      
                  // remove any expression fields as they are already baked into the query
                  $values = array_values(array_diff_key($this->_dirty_fields, $this->_expr_fields));
      Severity: Minor
      Found in idiorm.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 _log_query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

              protected static function _log_query($query, $parameters, $connection_name, $query_time) {
                  // If logging is not enabled, do nothing
                  if (!self::$_config[$connection_name]['logging']) {
                      return false;
                  }
      Severity: Minor
      Found in idiorm.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 id has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              public function id($disallow_null = false) {
                  $id = $this->get($this->_get_id_column_name());
      
                  if ($disallow_null) {
                      if (is_array($id)) {
      Severity: Minor
      Found in idiorm.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 save has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function save() {
                  $query = array();
      
                  // remove any expression fields as they are already baked into the query
                  $values = array_values(array_diff_key($this->_dirty_fields, $this->_expr_fields));
      Severity: Minor
      Found in idiorm.php - About 1 hr to fix

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

                protected static function _execute($query, $parameters = array(), $connection_name = self::DEFAULT_CONNECTION) {
                    $statement = self::get_db($connection_name)->prepare($query);
                    self::$_last_statement = $statement;
                    $time = microtime(true);
        
        
        Severity: Minor
        Found in idiorm.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 _normalise_select_many_columns has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                protected function _normalise_select_many_columns($columns) {
                    $return = array();
                    foreach($columns as $column) {
                        if(is_array($column)) {
                            foreach($column as $key => $value) {
        Severity: Minor
        Found in idiorm.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 _log_query has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                protected static function _log_query($query, $parameters, $connection_name, $query_time) {
                    // If logging is not enabled, do nothing
                    if (!self::$_config[$connection_name]['logging']) {
                        return false;
                    }
        Severity: Minor
        Found in idiorm.php - About 1 hr to fix

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

                  public function where_any_is($values, $operator='=') {
                      $data = array();
                      $query = array("((");
                      $first = true;
                      foreach ($values as $value) {
          Severity: Minor
          Found in idiorm.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 _set_orm_property has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  protected function _set_orm_property($key, $value = null, $expr = false) {
                      if (!is_array($key)) {
                          $key = array($key => $value);
                      }
                      foreach ($key as $field => $value) {
          Severity: Minor
          Found in idiorm.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

          Function _add_simple_condition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  protected function _add_simple_condition($type, $column_name, $separator, $value) {
                      $multiple = is_array($column_name) ? $column_name : array($column_name => $value);
                      $result = $this;
          
                      foreach($multiple as $key => $val) {
          Severity: Minor
          Found in idiorm.php - About 35 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

          Function _create_placeholders has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  protected function _create_placeholders($fields) {
                      if(!empty($fields)) {
                          $db_fields = array();
                          foreach($fields as $key => $value) {
                              // Process expression fields directly into the query
          Severity: Minor
          Found in idiorm.php - About 35 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

          Function _call_aggregate_db_function has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  protected function _call_aggregate_db_function($sql_function, $column) {
                      $alias = strtolower($sql_function);
                      $sql_function = strtoupper($sql_function);
                      if('*' != $column) {
                          $column = $this->_quote_identifier($column);
          Severity: Minor
          Found in idiorm.php - About 35 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

          Function select_many has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  public function select_many() {
                      $columns = func_get_args();
                      if(!empty($columns)) {
                          $columns = $this->_normalise_select_many_columns($columns);
                          foreach($columns as $alias => $column) {
          Severity: Minor
          Found in idiorm.php - About 25 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

          Function configure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  public static function configure($key, $value = null, $connection_name = self::DEFAULT_CONNECTION) {
                      self::_setup_db_config($connection_name); //ensures at least default config is set
          
                      if (is_array($key)) {
                          // Shortcut: If only one array argument is passed,
          Severity: Minor
          Found in idiorm.php - About 25 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

          Function select_many_expr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  public function select_many_expr() {
                      $columns = func_get_args();
                      if(!empty($columns)) {
                          $columns = $this->_normalise_select_many_columns($columns);
                          foreach($columns as $alias => $column) {
          Severity: Minor
          Found in idiorm.php - About 25 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