From: Matthias Schmidt Date: Fri, 21 Jun 2019 11:18:33 +0000 (+0200) Subject: Add IObjectTreeNode::getParentNode() X-Git-Tag: 5.2.0_Alpha_1~28 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9ad13b9daea24fd921b3ab06c0dcbb31c352e16;p=GitHub%2FWoltLab%2FWCF.git Add IObjectTreeNode::getParentNode() See #2938 --- diff --git a/wcfsetup/install/files/lib/data/IObjectTreeNode.class.php b/wcfsetup/install/files/lib/data/IObjectTreeNode.class.php index 4d6b15af98..b8e6e3dfaa 100644 --- a/wcfsetup/install/files/lib/data/IObjectTreeNode.class.php +++ b/wcfsetup/install/files/lib/data/IObjectTreeNode.class.php @@ -35,6 +35,13 @@ interface IObjectTreeNode extends \Countable, IIDObject, \RecursiveIterator { */ public function getOpenParentNodes(); + /** + * Retruns the parent node of this node. + * + * @return static parent node + */ + public function getParentNode(); + /** * Returns `true` if this node is the last sibling and `false` otherwise. * diff --git a/wcfsetup/install/files/lib/data/TObjectTreeNode.class.php b/wcfsetup/install/files/lib/data/TObjectTreeNode.class.php index 3a05e1ece2..6756babc44 100644 --- a/wcfsetup/install/files/lib/data/TObjectTreeNode.class.php +++ b/wcfsetup/install/files/lib/data/TObjectTreeNode.class.php @@ -14,7 +14,7 @@ use wcf\util\ClassUtil; trait TObjectTreeNode { /** * child nodes - * @var TObjectTreeNode[] + * @var static[] */ protected $children = []; @@ -26,7 +26,7 @@ trait TObjectTreeNode { /** * parent node object - * @var TObjectTreeNode + * @var static */ protected $parentNode = null; @@ -58,7 +58,7 @@ trait TObjectTreeNode { /** * Return the currently iterated child node. * - * @return IObjectTreeNode + * @return static */ public function current() { return $this->children[$this->index]; @@ -67,7 +67,7 @@ trait TObjectTreeNode { /** * Returns an iterator for the currently iterated child node by returning the node itself. * - * @return IObjectTreeNode + * @return static */ public function getChildren() { return $this->children[$this->index]; @@ -109,6 +109,15 @@ trait TObjectTreeNode { return $i; } + /** + * Retruns the parent node of this node. + * + * @return static parent node + */ + public function getParentNode() { + return $this->parentNode; + } + /** * Returns `true` if the node as any children and return `false` otherwise. *