1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<?php
namespace Basho\Riak\Search;
use Basho\Riak\Bucket;
use Basho\Riak\Location;
class Doc
{
protected $data = null;
protected $_yz_id = '';
protected $_yz_rk = '';
protected $_yz_rt = '';
protected $_yz_rb = '';
public function __construct(\stdClass $data)
{
if (isset($data->_yz_id)) {
$this->_yz_id = $data->_yz_id;
unset($data->_yz_id);
}
if (isset($data->_yz_rk)) {
$this->_yz_rk = $data->_yz_rk;
unset($data->_yz_rk);
}
if (isset($data->_yz_rt)) {
$this->_yz_rt = $data->_yz_rt;
unset($data->_yz_rt);
}
if (isset($data->_yz_rb)) {
$this->_yz_rb = $data->_yz_rb;
unset($data->_yz_rb);
}
$this->data = $data;
}
public function getLocation()
{
return new Location($this->_yz_rk, new Bucket($this->_yz_rb, $this->_yz_rt));
}
public function __get($name)
{
return $this->data->{$name};
}
}