Skip to content

Commit

Permalink
Merge pull request #74 from s-chizhik/s_chizhik_add_method
Browse files Browse the repository at this point in the history
Add \XBase\Record::getData
  • Loading branch information
gam6itko authored Jan 29, 2020
2 parents 810ab66 + d52c897 commit ce78739
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/XBase/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,36 @@ public function serializeRawData()
{
return ($this->deleted ? '*' : ' ') . implode('', $this->choppedData);
}

/**
* Returns typed column values according to their types
*
* @return array
*/
public function getData()
{
$fields = array();

foreach ($this->getColumns() as $column) {
$fields[$column->name] = $this->getObject($column);
}

return $fields;
}

/**
* Returns raw values trimmed and converted according to encoding
*
* @return array|string[]
*/
public function getChoppedData()
{
$fields = array();

foreach ($this->choppedData as $columnName => $columnValue) {
$fields[$columnName] = $this->forceGetString($columnName);
}

return $fields;
}
}

0 comments on commit ce78739

Please sign in to comment.