/** * @expectedException \LogicException */ public function testSetContentInvalidContent() { $obj = new SectionNode(); $obj->setContent('invalid'); }
private function appendToSection(NodeInterface $node, $section = null) { $structure = $this->getData(); $itemCount = count($structure); if (false === $this->hasSection($section) && null !== $section) { $newSection = new SectionNode(); $newSection->setContent("[{$section}]"); $structure[] = $newSection; } $inCorrectSection = null === $section; $currentSection = null; $added = false; for ($n = 0; $n < $itemCount; $n++) { $currNode = $structure[$n]; if ($currNode instanceof SectionNode) { if ($inCorrectSection) { array_splice($structure, $n, 0, array($node)); $added = true; break; } $currentSection = $currNode->getValue(); $inCorrectSection = $currentSection == $section; } } // for when we want to append to the last section .... if (false === $added) { $structure[] = $node; } $this->data = $structure; }