1 | <?php |
||
8 | class Document |
||
9 | { |
||
10 | /** |
||
11 | * @var String $path : The file path in the filesystem |
||
12 | */ |
||
13 | private $path; |
||
14 | /** |
||
15 | * @var String $name : The file name (basename of the path). |
||
16 | */ |
||
17 | private $name; |
||
18 | /** |
||
19 | * @var int $size : The file size. |
||
20 | */ |
||
21 | private $size; |
||
22 | /** |
||
23 | * @var DOMDocument $domDocument : The DOMDocument instance of the loaded file. |
||
24 | */ |
||
25 | private $domDocument; |
||
26 | /** |
||
27 | * @var Node $rootNode : The Node instance of the first Node of the file. |
||
28 | */ |
||
29 | private $rootNode; |
||
30 | |||
31 | /** |
||
32 | * Perform usual checks over the given path and if everything is fine, fill class attributes and build tree nodes objects. |
||
33 | * |
||
34 | * @param String $path : Path's file to open. |
||
35 | */ |
||
36 | public function __construct(DOMDocument $domDocument = null, Node $rootNode = null, $path = null, $name = null, $size = null) { |
||
43 | |||
44 | /** |
||
45 | * Return the file path. |
||
46 | * |
||
47 | * @return String : The file path. |
||
48 | */ |
||
49 | public function getPath() { |
||
52 | |||
53 | /** |
||
54 | * Set the file path. |
||
55 | * |
||
56 | * @param String $path : The file path. |
||
57 | */ |
||
58 | public function setPath($path) { |
||
61 | |||
62 | /** |
||
63 | * Return the file name. |
||
64 | * |
||
65 | * @return String : The file name. |
||
66 | */ |
||
67 | public function getName() { |
||
70 | |||
71 | /** |
||
72 | * Set the file name. |
||
73 | * |
||
74 | * @param String $name : The file name. |
||
75 | */ |
||
76 | public function setName($name) { |
||
79 | |||
80 | /** |
||
81 | * Return the file size. |
||
82 | * |
||
83 | * @return int : The file size. |
||
84 | */ |
||
85 | public function getSize() { |
||
88 | |||
89 | /** |
||
90 | * Set the file size. |
||
91 | * |
||
92 | * @param int $size : The file size. |
||
93 | */ |
||
94 | public function setSize($size) { |
||
97 | |||
98 | /** |
||
99 | * Return the DOMDocument instance. |
||
100 | * |
||
101 | * @return DOMDocument : The DOMDocument instance. |
||
102 | */ |
||
103 | public function getDomDocument() { |
||
106 | |||
107 | /** |
||
108 | * Set the DOMDocument instance. |
||
109 | * |
||
110 | * @param DOMDocument $domDocument : The DOMDocument instance. |
||
111 | */ |
||
112 | public function setDomDocument($domDocument) { |
||
115 | |||
116 | /** |
||
117 | * Return the root Node instance. |
||
118 | * |
||
119 | * @return Node : The node instance. |
||
120 | */ |
||
121 | public function getRootNode() { |
||
124 | |||
125 | /** |
||
126 | * Set the root Node instance. |
||
127 | * |
||
128 | * @param Node $rootNode : The node instance. |
||
129 | */ |
||
130 | public function setRootNode($rootNode) { |
||
133 | |||
134 | /** |
||
135 | * To String method. |
||
136 | * |
||
137 | * @return String : The name of the file. |
||
138 | */ |
||
139 | public function __toString() { |
||
142 | |||
143 | /** |
||
144 | * Transform the objects tree in an array tree. |
||
145 | * |
||
146 | * @return Array $array : The array tree. |
||
147 | */ |
||
148 | public function toArray() { |
||
165 | } |