original_string: public function setParent($parent)
  	{
  		if ($parent instanceof JCategoryNode || is_null($parent))
  		{
  			if (!is_null($this->_parent))
  			{
  				$key = array_search($this, $this->_parent->_children);
  				unset($this->_parent->_children[$key]);
  			}
  
  			if (!is_null($parent))
  			{
  				$parent->_children[] = & $this;
  			}
  
  			$this->_parent = $parent;
  
  			if ($this->id != 'root')
  			{
  				if ($this->parent_id != 1)
  				{
  					$this->_path = $parent->getPath();
  				}
  
  				$this->_path[] = $this->id . ':' . $this->alias;
  			}
  
  			if (count($parent->_children) > 1)
  			{
  				end($parent->_children);
  				$this->_leftSibling = prev($parent->_children);
  				$this->_leftSibling->_rightsibling = & $this;
  			}
  		}
  	}
code: public function setParent($parent)
  	{
  		if ($parent instanceof JCategoryNode || is_null($parent))
  		{
  			if (!is_null($this->_parent))
  			{
  				$key = array_search($this, $this->_parent->_children);
  				unset($this->_parent->_children[$key]);
  			}
  
  			if (!is_null($parent))
  			{
  				$parent->_children[] = & $this;
  			}
  
  			$this->_parent = $parent;
  
  			if ($this->id != 'root')
  			{
  				if ($this->parent_id != 1)
  				{
  					$this->_path = $parent->getPath();
  				}
  
  				$this->_path[] = $this->id . ':' . $this->alias;
  			}
  
  			if (count($parent->_children) > 1)
  			{
  				end($parent->_children);
  				$this->_leftSibling = prev($parent->_children);
  				$this->_leftSibling->_rightsibling = & $this;
  			}
  		}
  	}
code_tokens: public function setParent ( $ parent ) { if ( $ parent instanceof JCategoryNode || is_null ( $ parent ) ) { if ( ! is_null ( $ this -> _parent ) ) { $ key = array_search ( $ this , $ this -> _parent -> _children ) ; unset ( $ this -> _parent -> _children [ $ key ] ) ; } if ( ! is_null ( $ parent ) ) { $ parent -> _children [ ] = & $ this ; } $ this -> _parent = $ parent ; if ( $ this -> id != 'root' ) { if ( $ this -> parent_id != 1 ) { $ this -> _path = $ parent -> getPath ( ) ; } $ this -> _path [ ] = $ this -> id . ':' . $ this -> alias ; } if ( count ( $ parent -> _children ) > 1 ) { end ( $ parent -> _children ) ; $ this -> _leftSibling = prev ( $ parent -> _children ) ; $ this -> _leftSibling -> _rightsibling = & $ this ; } } }
docstring: Set the parent of this category
  
  If the category already has a parent, the link is unset
  
  @param   mixed  $parent  JCategoryNode for the parent to be set or null
  
  @return  void
  
  @since   11.1
docstring_tokens: Set the parent of this category