original_string: public static function extract_record($row, $prefix = null) {
          if ($prefix === null) {
              $prefix = str_replace('_', '', static::TABLE) . '_';
          }
          $prefixlength = strlen($prefix);
  
          $data = new stdClass();
          foreach ($row as $property => $value) {
              if (strpos($property, $prefix) === 0) {
                  $propertyname = substr($property, $prefixlength);
                  $data->$propertyname = $value;
              }
          }
  
          return $data;
      }
code: public static function extract_record($row, $prefix = null) {
          if ($prefix === null) {
              $prefix = str_replace('_', '', static::TABLE) . '_';
          }
          $prefixlength = strlen($prefix);
  
          $data = new stdClass();
          foreach ($row as $property => $value) {
              if (strpos($property, $prefix) === 0) {
                  $propertyname = substr($property, $prefixlength);
                  $data->$propertyname = $value;
              }
          }
  
          return $data;
      }
code_tokens: public static function extract_record ( $ row , $ prefix = null ) { if ( $ prefix === null ) { $ prefix = str_replace ( '_' , '' , static :: TABLE ) . '_' ; } $ prefixlength = strlen ( $ prefix ) ; $ data = new stdClass ( ) ; foreach ( $ row as $ property => $ value ) { if ( strpos ( $ property , $ prefix ) === 0 ) { $ propertyname = substr ( $ property , $ prefixlength ) ; $ data -> $ propertyname = $ value ; } } return $ data ; }
docstring: Extract a record from a row of data.
  
  Most likely used in combination with {@link self::get_sql_fields()}. This method is
  simple enough to be used by non-persistent classes, keep that in mind when modifying it.
  
  e.g. persistent::extract_record($row, 'user'); should work.
  
  @param stdClass $row The row of data.
  @param string $prefix The prefix the data fields are prefixed with, defaults to the table name followed by underscore.
  @return stdClass The extracted data.
docstring_tokens: Extract a record from a row of data .