$response = (new Riak\Command\Builder\UpdateMap($this->riak))->updateFlag('paid_account', true)->atLocation($this->location)->withParameter('returnbody', 'true')->build()->execute(); if ($response->isSuccess()) { $this->data = $response->getMap(); } return $this; } public function downgradeAccount() { $response = (new Riak\Command\Builder\UpdateMap($this->riak))->updateFlag('paid_account', false)->atLocation($this->location)->withParameter('returnbody', 'true')->build()->execute(); if ($response->isSuccess()) { $this->data = $response->getMap(); } return $this; } public function getFirstName() { return $this->getData()->getRegister('first_name'); } public function getLastName() { return $this->getData()->getRegister('last_name'); } } $riak = new Riak((new Riak\Node\Builder())->buildLocalhost([8087])); $iAmBatman = new User($riak, 'Bruce', 'Wayne'); $iAmBatman->addInterests(['crime fighting', 'climbing stuff']); // prints json to standard out echo $iAmBatman; //----------------------------------------------------------- $joe = (new User($riak, 'Joe', 'Armstrong'))->addInterests(['distributed systems', 'Erlang'])->recordVisit(); var_dump($joe->getFirstName(), $joe->getLastName(), $joe->getInterests(), $joe->getVisitCount(), $joe->recordVisit()->getVisitCount(), $joe->getPaidAccount());