Skip to content

Commit

Permalink
Don't fail during the construction of Node objects
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent 52fcbdf commit 3b4b32d
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions libraries/navigation/Nodes/Node.class.php
Expand Up @@ -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
Expand Down Expand Up @@ -116,24 +116,19 @@ 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)
{
$this->_commonFunctions = PMA_commonFunctions::getInstance();
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;
}

/**
Expand Down

0 comments on commit 3b4b32d

Please sign in to comment.