original_string: public function insert($table, array $data)
      {
          $table = $this->getTable($table);
          $field = implode(', ', array_keys($data));
  
          $placeholder = array();
          foreach ($data as $key => $value) {
              if ($value instanceof \stdClass && isset($value->scalar)) {
                  $placeholder[] = $value->scalar;
                  unset($data[$key]);
              } else {
                  $placeholder[] = '?';
              }
          }
          $placeholder = implode(', ', $placeholder);
  
          $query = "INSERT INTO $table ($field) VALUES ($placeholder)";
          return $this->executeUpdate($query, array_values($data));
      }
code: public function insert($table, array $data)
      {
          $table = $this->getTable($table);
          $field = implode(', ', array_keys($data));
  
          $placeholder = array();
          foreach ($data as $key => $value) {
              if ($value instanceof \stdClass && isset($value->scalar)) {
                  $placeholder[] = $value->scalar;
                  unset($data[$key]);
              } else {
                  $placeholder[] = '?';
              }
          }
          $placeholder = implode(', ', $placeholder);
  
          $query = "INSERT INTO $table ($field) VALUES ($placeholder)";
          return $this->executeUpdate($query, array_values($data));
      }
code_tokens: public function insert ( $ table , array $ data ) { $ table = $ this -> getTable ( $ table ) ; $ field = implode ( ', ' , array_keys ( $ data ) ) ; $ placeholder = array ( ) ; foreach ( $ data as $ key => $ value ) { if ( $ value instanceof \ stdClass && isset ( $ value -> scalar ) ) { $ placeholder [ ] = $ value -> scalar ; unset ( $ data [ $ key ] ) ; } else { $ placeholder [ ] = '?' ; } } $ placeholder = implode ( ', ' , $ placeholder ) ; $ query = "INSERT INTO $table ($field) VALUES ($placeholder)" ; return $ this -> executeUpdate ( $ query , array_values ( $ data ) ) ; }
docstring: Executes an INSERT query to insert specified data into table
  
  @param string $table The name of table
  @param array $data An associative array containing column-value pairs
  @return int The number of affected rows
docstring_tokens: Executes an INSERT query to insert specified data into table