/** * Collects items from the result of a DynamoDB operation and returns them as an ItemIterator. * * @param Collection $result The result of a DynamoDB operation that potentially contains items * (e.g., BatchGetItem, DeleteItem, GetItem, PutItem, Query, Scan, UpdateItem) * * @return self */ public static function fromResult(Collection $result) { if (!($items = $result->get('Items'))) { if ($item = $result->get('Item') ?: $result->get('Attributes')) { $items = array($item); } else { $items = $result->getPath('Responses/*'); } } return new self(new \ArrayIterator($items ?: array())); }
/** * @dataProvider getPathProvider */ public function testGetPath(Collection $c, $path, $expected, $separator = '/') { $this->assertEquals($expected, $c->getPath($path, $separator)); }