/** * Test that we can iterate over the result object */ public function testIterator() { $rows = [$this->getMock('Silktide\\SemRushApi\\Model\\Row'), $this->getMock('Silktide\\SemRushApi\\Model\\Row'), $this->getMock('Silktide\\SemRushApi\\Model\\Row')]; $this->instance->setRows($rows); foreach ($this->instance as $id => $row) { $this->assertEquals($rows[$id], $row); } }
/** * Takes raw API data and converts into a result * * @param array $data * @return Result */ public function create($data) { $result = new Result(); $rows = []; foreach ($data as $row) { $rows[] = $this->rowFactory->create($row); } $result->setRows($rows); return $result; }