1 <?php
2 3 4 5 6 7
8
9 namespace Cross\Lib\Document;
10
11 use DOMDocument;
12
13 14 15 16 17 18 19
20 class CallTree
21 {
22
23 private $node = array();
24
25 private function __construct()
26 {
27
28 }
29
30 public static function getInstance()
31 {
32 return new CallTree();
33 }
34
35 36 37 38 39 40
41 function saveNode($node_name, $node_arguments)
42 {
43 $this->node = array($node_name => $node_arguments);
44 }
45
46 47 48 49
50 function html($html_decode = true)
51 {
52 echo $this->nodeToHTML($html_decode);
53 }
54
55 56 57 58 59
60 function dom()
61 {
62 return CallTreeToHTML::getInstance()->getDom($this->getNode());
63 }
64
65 66 67 68 69
70 function getNode()
71 {
72 return $this->node;
73 }
74
75 76 77 78 79
80 function __toString()
81 {
82 return $this->nodeToHTML();
83 }
84
85 86 87 88 89 90
91 private function nodeToHTML($html_decode = true)
92 {
93 return CallTreeToHTML::getInstance()->getHTML($this->getNode(), $html_decode);
94 }
95 }
96