Example #1
0
 public function appendText($text)
 {
     $children = $this->currentContainer->getChildren();
     if (sizeof($children) > 0) {
         $last = array_pop($children);
         if ($last->getType() == 'text') {
             $last->setText($last->getText() . $text);
             return;
         }
     }
     $node = new JsonFormatTextNode($text);
     $this->currentContainer->addChild($node);
 }
 private function findSections(\JsonFormatNode $node, &$sections)
 {
     if ($node instanceof \JsonFormatRootNode || $node instanceof \JsonFormatSectionNode) {
         $sections[] = $node;
     }
     if ($node instanceof \JsonFormatContainerNode) {
         foreach ($node->getChildren() as $childNode) {
             $this->findSections($childNode, $sections);
         }
     }
 }