File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function deleteLeaf(Leaf $leaf);
3434 * @param \PNX\Tree\Leaf $leaf
3535 * The leaf to delete.
3636 */
37- public function deleteLeafAndDescendants (Leaf $ leaf );
37+ public function deleteSubTree (Leaf $ leaf );
3838
3939 /**
4040 * Finds all descendants of a leaf.
@@ -73,4 +73,14 @@ public function findAncestors(Leaf $leaf);
7373 */
7474 public function getLeaf ($ id , $ revision_id );
7575
76+ /**
77+ * Moves a Leaf and its sub-tree under a new parent leaf.
78+ *
79+ * @param \PNX\Tree\Leaf $parent
80+ * The parent leaf to move under.
81+ * @param \PNX\Tree\Leaf $leaf
82+ * The leaf to move.
83+ */
84+ public function moveSubTree (Leaf $ parent , Leaf $ leaf );
85+
7686}
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ public function deleteLeaf(Leaf $leaf) {
216216 /**
217217 * {@inheritdoc}
218218 */
219- public function deleteLeafAndDescendants (Leaf $ leaf ) {
219+ public function deleteSubTree (Leaf $ leaf ) {
220220 $ left = $ leaf ->getLeft ();
221221 $ right = $ leaf ->getRight ();
222222 $ width = $ right - $ left + 1 ;
@@ -246,4 +246,11 @@ public function deleteLeafAndDescendants(Leaf $leaf) {
246246
247247 }
248248
249+ /**
250+ * {@inheritdoc}
251+ */
252+ public function moveSubTree (Leaf $ parent , Leaf $ leaf ) {
253+ // TODO: Implement moveSubTree() method.
254+ }
255+
249256}
Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ public function testDeleteLeafAndDescendants() {
220220
221221 $ leaf = $ this ->nestedSet ->getLeaf (4 , 1 );
222222
223- $ this ->nestedSet ->deleteLeafAndDescendants ($ leaf );
223+ $ this ->nestedSet ->deleteSubTree ($ leaf );
224224
225225 // Leaf should be deleted.
226226 $ leaf = $ this ->nestedSet ->getLeaf (4 , 1 );
You can’t perform that action at this time.
0 commit comments