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 $this * @throws \Exception */ function addRowName($rowName) { $this->rows->addName($rowName); return $this; }
/** * @param string $colName * * @return $this * @throws \Exception */ function addColName($colName) { $this->columns->addName($colName); return $this; }