/** * @param SectionInterface $section * @param Anchor[] $anchors * * @dataProvider anchorProvider */ public function testGetAnchor(SectionInterface $section, array $anchors) { $results = []; foreach ($anchors as $pos => $anchor) { $results[$pos] = $section->getAnchor((double) $pos); } $this->assertEquals($anchors, $results); }
private function addSection(SectionInterface $section) { if ($this->isEmpty()) { $this->table[] = $curElement = new TableElement(0.0, 0.0, $section, $section->getAnchor(0.0)); } else { $curElement = end($this->table); } for ($i = 1; $i <= $section->segmentCount(); $i++) { $t = $i / (double) $section->segmentCount(); $anchor = $section->getAnchor($t); $pos = $curElement->pos + $curElement->anchor->getDistanceTo($anchor); $this->table[] = $curElement = new TableElement($pos, $t, $section, $anchor); } }