public function testAddConverter() { $this->assertEmpty($this->instance->getConverters()); $mock = $this->getMock('Riak\\Client\\Converter\\Converter'); $this->instance->addConverter(SimpleObject::CLASS_NAME, $mock); $converter = $this->instance->getConverter(SimpleObject::CLASS_NAME); $converters = $this->instance->getConverters(); $this->assertInstanceOf('Riak\\Client\\Converter\\Converter', $converter); $this->assertArrayHasKey(SimpleObject::CLASS_NAME, $converters); $this->assertSame($converter, $converters[SimpleObject::CLASS_NAME]); }
/** * Get all the objects returned in this response. * If a type is provided will be converted to the supplied class using the convert api. * * @param string $type * * @return \Riak\Client\Core\Query\RiakList */ public function getValues($type = null) { if ($type == null) { return $this->values; } $converter = $this->converterFactory->getConverter($type); $resultList = []; foreach ($this->values as $riakObject) { $reference = new RiakObjectReference($riakObject, $this->location, $type); $converted = $converter->toDomain($reference); $resultList[] = $converted; } return new DomainObjectList($resultList); }