1 | <?php |
||
13 | class Item |
||
14 | { |
||
15 | /** |
||
16 | * The parent CHM instance. |
||
17 | * |
||
18 | * @var CHM |
||
19 | */ |
||
20 | protected $chm; |
||
21 | |||
22 | /** |
||
23 | * The name of the tree item. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $name; |
||
28 | |||
29 | /** |
||
30 | * The keyword of the tree item. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $keyword; |
||
35 | |||
36 | /** |
||
37 | * The local path to the tree item. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $local; |
||
42 | |||
43 | /** |
||
44 | * The path to an entry in another CHM file. |
||
45 | * |
||
46 | * @var array|null If not null, it's an array with two keys: 'chm' and 'entry'. |
||
47 | */ |
||
48 | protected $merge; |
||
49 | |||
50 | /** |
||
51 | * The image number attribute. |
||
52 | * |
||
53 | * @var int|null |
||
54 | */ |
||
55 | protected $imageNumber; |
||
56 | |||
57 | /** |
||
58 | * The sub-elements of this Item. |
||
59 | * |
||
60 | * @var Tree|null |
||
61 | */ |
||
62 | protected $subTree; |
||
63 | |||
64 | /** |
||
65 | * Initializes the instance. |
||
66 | * |
||
67 | * @param CHM $chm The parent CHM instance. |
||
68 | */ |
||
69 | protected function __construct(CHM $chm) |
||
79 | |||
80 | /** |
||
81 | * Get the name of the tree item. |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getName() |
||
89 | |||
90 | /** |
||
91 | * Get the keyword of the tree item. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getKeyword() |
||
99 | |||
100 | /** |
||
101 | * Get the local path to the tree item. |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public function getLocal() |
||
109 | |||
110 | /** |
||
111 | * Get the path to an entry in another CHM file. |
||
112 | * |
||
113 | * @var array|null If not null, it's an array with two keys: 'chm' and 'entry'. |
||
114 | */ |
||
115 | public function getMerge() |
||
119 | |||
120 | /** |
||
121 | * Get the image number attribute. |
||
122 | * |
||
123 | * @return int|null |
||
124 | */ |
||
125 | public function getImageNumber() |
||
129 | |||
130 | /** |
||
131 | * Get the sub-elements of this Item. |
||
132 | * |
||
133 | * @return Tree|null |
||
134 | */ |
||
135 | public function getSubTree() |
||
139 | |||
140 | /** |
||
141 | * Resolve the items contained in other CHM files. |
||
142 | * |
||
143 | * @param Map $map |
||
144 | * |
||
145 | * @throws Exception Throw an Exception in case of errors. |
||
146 | * |
||
147 | * @return static[] |
||
148 | */ |
||
149 | public function resolve(Map $map) |
||
169 | |||
170 | /** |
||
171 | * Create a new instance starting from a LI element. |
||
172 | * |
||
173 | * @param CHM $chm The parent CHM instance. |
||
174 | * @param DOMElement $li |
||
175 | * |
||
176 | * @throws Exception Throw an Exception in case of errors. |
||
177 | * |
||
178 | * @return static |
||
179 | */ |
||
180 | public static function fromLI(CHM $chm, DOMElement $li) |
||
209 | |||
210 | /** |
||
211 | * Create a new instance starting from a LI element or from an OBJECT. |
||
212 | * |
||
213 | * @param CHM $chm The parent CHM instance. |
||
214 | * @param DOMElement $object |
||
215 | * |
||
216 | * @throws Exception Throw an Exception in case of errors. |
||
217 | * |
||
218 | * @return static |
||
219 | */ |
||
220 | public static function fromObject(CHM $chm, DOMElement $object) |
||
261 | } |
||
262 |