src/Record/Transformer.php
public static function toRecord($data, RecordInterface $root = null)
    {
        $visitor   = new RecordSerializeVisitor($root);
        $traverser = new GraphTraverser();
        $traverser->traverse($data, $visitor);

        return $visitor->getObject();
    }
public static function toRecord($data, RecordInterface $root = null)
    {
        $visitor   = new RecordSerializeVisitor($root);
        $traverser = new GraphTraverser();
        $traverser->traverse($data, $visitor);

        return $visitor->getObject();
    }
Transforms an arbitrary data structure into a record graph

@param mixed $data
@param \PSX\Record\RecordInterface $root
@return \PSX\Record\RecordInterface