Example #1
0
 public function onTextEvent(TextEvent $textEvent)
 {
     if ($this->valueNode === null) {
         $this->current->setValue($textEvent->getText());
         return;
     }
     if (($text = trim($textEvent->getText())) != '' || $this->stripEmpty === false) {
         $this->current->addNode($this->createNode($this->valueNode, [], $textEvent->getText()));
     }
 }
 protected function walk(array $array, INode $root)
 {
     foreach ($array as $k => $v) {
         $root->addNode($node = new Node($k));
         if (!is_array($v)) {
             $node->setValue($v);
             continue;
         }
         $this->walk($v, $node);
     }
 }