From 3b4b32df270510a0a4f8b3fa44ad00fca362057c Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Fri, 13 Jul 2012 19:40:38 +0100 Subject: [PATCH] Don't fail during the construction of Node objects --- libraries/navigation/Nodes/Node.class.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index b5765fdca4..22b5314d3e 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -26,18 +26,18 @@ class Node * @var string A non-unique identifier for the node * This may be trimmed when grouping nodes */ - public $name; + public $name = ""; /** * @var string A non-unique identifier for the node * This will never change after being assigned */ - public $real_name; + public $real_name = ""; /** * @var int May be one of CONTAINER or OBJECT */ - public $type; + public $type = Node::OBJECT; /** * @var bool Whether this object has been created while grouping nodes @@ -116,7 +116,7 @@ class Node * @param bool $is_group Whether this object has been created * while grouping nodes * - * @return bool Whether the initialisation was successful + * @return Node */ public function __construct($name, $type = Node::OBJECT, $is_group = false) { @@ -124,16 +124,11 @@ class Node if (! empty($name)) { $this->name = $name; $this->real_name = $name; - if ($type === 0 || $type === 1) { - $this->type = $type; - if (is_bool($is_group)) { - $this->is_group = $is_group; - return true; - } - } } - return false; - + if ($type === Node::CONTAINER) { + $this->type = Node::CONTAINER; + } + $this->is_group = (bool)$is_group; } /**