original_string: protected function getColumnNameFromData($columnName, $data, $default = null)
      {
          /*
           * Array column name, eg: column[key][key2][key3]
           */
          $keyParts = HtmlHelper::nameToArray($columnName);
          $result = $data;
  
          /*
           * Loop the column key parts and build a value.
           * To support relations only the last column should return the
           * relation value, all others will look up the relation object as normal.
           */
          foreach ($keyParts as $key) {
              if ($result instanceof Model && $result->hasRelation($key)) {
                  $result = $result->{$key};
              }
              else {
                  if (is_array($result) && array_key_exists($key, $result)) {
                      return $result[$key];
                  }
                  if (!isset($result->{$key})) {
                      return $default;
                  }
  
                  $result = $result->{$key};
              }
          }
  
          return $result;
      }
code: protected function getColumnNameFromData($columnName, $data, $default = null)
      {
          /*
           * Array column name, eg: column[key][key2][key3]
           */
          $keyParts = HtmlHelper::nameToArray($columnName);
          $result = $data;
  
          /*
           * Loop the column key parts and build a value.
           * To support relations only the last column should return the
           * relation value, all others will look up the relation object as normal.
           */
          foreach ($keyParts as $key) {
              if ($result instanceof Model && $result->hasRelation($key)) {
                  $result = $result->{$key};
              }
              else {
                  if (is_array($result) && array_key_exists($key, $result)) {
                      return $result[$key];
                  }
                  if (!isset($result->{$key})) {
                      return $default;
                  }
  
                  $result = $result->{$key};
              }
          }
  
          return $result;
      }
code_tokens: protected function getColumnNameFromData ( $ columnName , $ data , $ default = null ) { /*
           * Array column name, eg: column[key][key2][key3]
           */ $ keyParts = HtmlHelper :: nameToArray ( $ columnName ) ; $ result = $ data ; /*
           * Loop the column key parts and build a value.
           * To support relations only the last column should return the
           * relation value, all others will look up the relation object as normal.
           */ foreach ( $ keyParts as $ key ) { if ( $ result instanceof Model && $ result -> hasRelation ( $ key ) ) { $ result = $ result -> { $ key } ; } else { if ( is_array ( $ result ) && array_key_exists ( $ key , $ result ) ) { return $ result [ $ key ] ; } if ( ! isset ( $ result -> { $ key } ) ) { return $ default ; } $ result = $ result -> { $ key } ; } } return $ result ; }
docstring: Internal method to extract the value of a column name from a data set.
  @param string $columnName
  @param mixed $data
  @param mixed $default
  @return mixed
docstring_tokens: Internal method to extract the value of a column name from a data set .