Skip to content

Commit ce78739

Browse files
authored
Merge pull request #74 from s-chizhik/s_chizhik_add_method
Add \XBase\Record::getData
2 parents 810ab66 + d52c897 commit ce78739

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/XBase/Record.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,4 +650,36 @@ public function serializeRawData()
650650
{
651651
return ($this->deleted ? '*' : ' ') . implode('', $this->choppedData);
652652
}
653+
654+
/**
655+
* Returns typed column values according to their types
656+
*
657+
* @return array
658+
*/
659+
public function getData()
660+
{
661+
$fields = array();
662+
663+
foreach ($this->getColumns() as $column) {
664+
$fields[$column->name] = $this->getObject($column);
665+
}
666+
667+
return $fields;
668+
}
669+
670+
/**
671+
* Returns raw values trimmed and converted according to encoding
672+
*
673+
* @return array|string[]
674+
*/
675+
public function getChoppedData()
676+
{
677+
$fields = array();
678+
679+
foreach ($this->choppedData as $columnName => $columnValue) {
680+
$fields[$columnName] = $this->forceGetString($columnName);
681+
}
682+
683+
return $fields;
684+
}
653685
}

0 commit comments

Comments
 (0)