コード例 #1
0
 /**
  * Test that we can create a SemRush result
  */
 public function testCreate()
 {
     $columns = ["Db", "Dn", "Rk", "Or", "Ot", "Oc", "Ad", "At", "Ac"];
     $values = "us;seobook.com;29062;3214;33696;193957;0;0;0";
     $data = array_combine($columns, explode(";", $values));
     $row = $this->instance->create($data);
     $this->assertTrue($row instanceof Row);
     $this->assertEquals($data['Db'], $row->getValue('Db'));
 }
コード例 #2
0
 /**
  * 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;
 }