public function testStringEqualsHash() { $values = array(1, 2, 3); $hash = PivotKey::hash($values); $key = new PivotKey($values); $stringValue = $key->__toString(); $this->assertSame($hash, $stringValue, "Expect __toString to return the hash"); }
/** * @param int $rowIndex * @return PivotKey reference */ public function &getKeyRefByRowIndex($rowIndex) { $row = $this->dataTable->getRow($rowIndex); $columnValues = array(); foreach ($this->columnIndexes as $ci) { $columnValues[] = $row->getCell($ci)->getValue()->getRawValue(); } $hash = PivotKey::hash($columnValues); if (!isset($this->keys[$hash])) { $this->keys[$hash] = new PivotKey($columnValues); } $key =& $this->keys[$hash]; return $key; }