Exemplo n.º 1
0
 /**
  * @param Board $board
  * @param int $depth
  */
 protected function build(Board $board, $depth)
 {
     $board->write('INSERT INTO ');
     $this->table->build($board, $depth + 1);
     $board->write(" (");
     $this->columns->build($board, $depth + 1);
     $board->write(")\n");
     $this->data->build($board, $depth + 1);
 }
Exemplo n.º 2
0
 /**
  * @param Board $board
  * @param int $depth
  */
 protected function build(Board $board, $depth)
 {
     $board->write('UPDATE ');
     $this->table->build($board, $depth + 1);
     $board->write("\n");
     $board->write("SET ");
     $this->data->build($board, $depth + 1);
     $where = $this->where;
     if ($where) {
         $board->write("\n");
         $board->write('WHERE');
         $board->write($where->isBlock() ? "\n" : " ");
         $where->build($board, $depth + 1);
     }
 }
Exemplo n.º 3
0
 /**
  *
  * @param string $part
  * @param Node|null $node
  * @param Board $board
  * @param int $depth
  */
 protected function buildPart($part, $node, $board, $depth)
 {
     if ($node) {
         $indent = $board->indent($depth);
         $board->write($indent)->write($part);
         $board->write($node->isBlock() ? "\n" : ' ');
         $node->build($board, $depth + 1);
         $board->write("\n");
     }
 }
                        $markup .= $indent_chr . $indent_chr . $indent_str . '<span class="datum ' . $key . '">' . $value . '</span>' . "\n";
                        $markup .= $indent_chr . $indent_chr . $indent_str . '</li>' . "\n";
                    }
                    $markup .= $indent_chr . $indent_str . '</ol>' . "\n";
                }
                if (is_array($val->getChildren())) {
                    $this->nestList($val, $depth + 1, $markup);
                }
                $markup .= $indent_chr . $indent_str . '</li>' . "\n";
            }
            $markup .= $indent_str . '</ol>' . "\n";
        }
        return;
    }
}
$nodeTree = Node::build('root');
$nodeTree->setData(array('123' => 'abc'));
$nodeTree->insertByPath($nodeTree, 'root/A');
$nodeTree->insertByPath($nodeTree, 'root/B');
$nodeTree->insertByPath($nodeTree, 'root/B/C');
$nodeTree->insertByPath($nodeTree, 'root/B/D', array('foo' => 'a', 'bar' => 'b', 'baz' => 'c'));
$nodeTree->insertByPath($nodeTree, 'root/B');
$nodeTree->insertByPath($nodeTree, 'root/D/F/G/H/I');
#echo var_dump($nodeTree);
#$markup = '';
#$markup .= '<!DOCTYPE html>' . "\n";
##$nodeTree->nestDiv(null, 1, $markup);
#$nodeTree->nestList(null, 1, $markup);
$markup = '';
$markup .= '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$markup .= '<nodePath>' . "\n";