function testRegularTable() { $columns = new DynamicAxis(); $columns->addNames(['c0', 'c1', 'c2']); $tsection = new TableSection($columns); $tsection->addRow('r0')->td('c0', '00')->td('c1', '01')->td('c2', '02'); $tsection->addRow('r1')->td('c0', '10')->td('c1', '11')->td('c2', '12'); # print_r($tsection->getRawMatrix($columns->takeSnapshot())); }
function testNested() { $hierarchy = new DynamicAxis(); $hierarchy->addNames(['A.x', 'A.y', 'B.x']); $hierarchy->addName('A.x.22'); $this->assertEquals(['A.x' => ['A.x.22' => true], 'A' => ['A.x' => true, 'A.y' => true], 'A.y' => [], 'B.x' => [], 'B' => ['B.x' => true], 'A.x.22' => []], $hierarchy->getChildren()); $this->assertEquals(['A.x' => 'A', 'A.y' => 'A', 'B.x' => 'B', 'A' => null, 'B' => null, 'A.x.22' => 'A.x'], $hierarchy->getParents()); $this->assertEquals(['A' => true, 'B' => true], $hierarchy->getToplevelNames()); $snapshot = $hierarchy->takeSnapshot(); $this->assertEquals(['A.x.22', 'A.y', 'B.x'], $snapshot->getLeafNames()); }
/** * @param string $rowName * * @return true */ function rowExists($rowName) { return $this->rows->nameExists($rowName); }
/** * Sets the order for all columns or column groups at the top level, or at a * the relative top level within one group. * * @param string[] $orderedBaseColNames * @param string|null $groupPrefix * * @return $this * @throws \Exception */ function setColOrder($orderedBaseColNames, $groupPrefix = null) { $this->columns->setOrder($orderedBaseColNames, $groupPrefix); return $this; }