1 | <?php |
||
25 | class NodeManager |
||
26 | { |
||
27 | /** |
||
28 | * @var SessionInterface |
||
29 | */ |
||
30 | private $session; |
||
31 | |||
32 | /** |
||
33 | * @param SessionInterface $session |
||
34 | */ |
||
35 | public function __construct(SessionInterface $session) |
||
39 | |||
40 | /** |
||
41 | * Find a document with the given path or UUID. |
||
42 | * |
||
43 | * @param string $identifier UUID or path |
||
44 | * |
||
45 | * @return NodeInterface |
||
46 | * |
||
47 | * @throws DocumentNotFoundException |
||
48 | */ |
||
49 | public function find($identifier) |
||
63 | |||
64 | /** |
||
65 | * Determine if a node exists at the specified path or if a UUID is given, |
||
66 | * then if a node with the UUID exists. |
||
67 | * |
||
68 | * @param string $identifier |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | public function has($identifier) |
||
83 | |||
84 | /** |
||
85 | * Remove the document with the given path or UUID. |
||
86 | * |
||
87 | * @param string $identifier ID or path |
||
88 | */ |
||
89 | public function remove($identifier) |
||
94 | |||
95 | /** |
||
96 | * Move the document with the given path or ID to the path |
||
97 | * of the destination document (as a child). |
||
98 | * |
||
99 | * @param string $srcId |
||
100 | * @param string $destId |
||
101 | * @param string $name |
||
102 | */ |
||
103 | public function move($srcId, $destId, $name) |
||
111 | |||
112 | /** |
||
113 | * Copy the document with the given path or ID to the path |
||
114 | * of the destination document (as a child). |
||
115 | * |
||
116 | * @param string $srcId |
||
117 | * @param string $destId |
||
118 | * @param string $name |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function copy($srcId, $destId, $name) |
||
133 | |||
134 | /** |
||
135 | * Save all pending changes currently recorded in this Session. |
||
136 | */ |
||
137 | public function save() |
||
141 | |||
142 | /** |
||
143 | * Clear the current session. |
||
144 | */ |
||
145 | public function clear() |
||
149 | |||
150 | /** |
||
151 | * Create a path. |
||
152 | * |
||
153 | * @param string $path |
||
154 | * |
||
155 | * @return NodeInterface |
||
156 | */ |
||
157 | public function createPath($path) |
||
174 | |||
175 | /** |
||
176 | * Purge the workspace. |
||
177 | */ |
||
178 | public function purgeWorkspace() |
||
182 | |||
183 | /** |
||
184 | * Normalize the given path or ID to a path. |
||
185 | * |
||
186 | * @param string $identifier |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | private function normalizeToPath($identifier) |
||
198 | } |
||
199 |