/** * Returns siblings of the node, optionally including the node itself. * * @param bool $includeSelf If true, the node itself will be included in the resulting * array. In either case, the sort order will be correct. * This argument is deprecated and will be removed in v2.0 * * Note: The argument is deprecated and will be removed in version 2; please * use getSiblingsAndSelf(). * * @return Node[] */ public function getSiblings($includeSelf = false) { $siblings = array(); foreach ($this->parent->getChildren() as $child) { if ($includeSelf || (string) $child->getId() !== (string) $this->getId()) { $siblings[] = $child; } } return $siblings; }