Commit | Line | Data |
---|---|---|
755d49f0 | 1 | <?php |
a9229942 | 2 | |
755d49f0 MS |
3 | namespace wcf\data; |
4 | ||
5 | /** | |
6 | * Every node of a database object tree has to implement this interface. | |
a9229942 TD |
7 | * |
8 | * @author Matthias Schmidt | |
9 | * @copyright 2001-2019 WoltLab GmbH | |
10 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
11 | * @package WoltLabSuite\Core\Data | |
12 | * @since 5.2 | |
755d49f0 | 13 | */ |
a9229942 TD |
14 | interface IObjectTreeNode extends \Countable, IIDObject, \RecursiveIterator |
15 | { | |
16 | /** | |
17 | * Adds the given node as child node and sets the child node's parent node to this node. | |
18 | * | |
19 | * @param IObjectTreeNode $child added child node | |
20 | * @throws \InvalidArgumentException if given object is no (deocrated) instance of this class | |
21 | */ | |
22 | public function addChild(self $child); | |
23 | ||
24 | /** | |
25 | * Returns the depth of the node within the tree. | |
26 | * | |
27 | * The minimum depth is `1`. | |
28 | * | |
29 | * @return int | |
30 | */ | |
31 | public function getDepth(); | |
32 | ||
33 | /** | |
34 | * Returns the number of open parent nodes. | |
35 | * | |
36 | * @return int | |
37 | */ | |
38 | public function getOpenParentNodes(); | |
39 | ||
40 | /** | |
41 | * Retruns the parent node of this node. | |
42 | * | |
43 | * @return static parent node | |
44 | */ | |
45 | public function getParentNode(); | |
46 | ||
47 | /** | |
48 | * Returns `true` if this node is the last sibling and `false` otherwise. | |
49 | * | |
50 | * @return bool | |
51 | */ | |
52 | public function isLastSibling(); | |
53 | ||
54 | /** | |
55 | * Sets the parent node of this node. | |
56 | * | |
57 | * @param IObjectTreeNode $parentNode parent node | |
58 | * @throws \InvalidArgumentException if given object is no (deocrated) instance of this class | |
59 | */ | |
60 | public function setParentNode(self $parentNode); | |
755d49f0 | 61 | } |