diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2013-04-30 10:32:01 +0200 | 
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2013-04-30 10:32:01 +0200 | 
| commit | 8a4260703fa76bb92f144b527b3d55289568db74 (patch) | |
| tree | 604fa29f729eb50d638effe77f5cde90aaf3f9b9 | |
| parent | 2afa6730232cc2e92ae6543852d031a29c8a361f (diff) | |
| download | forums-8a4260703fa76bb92f144b527b3d55289568db74.tar forums-8a4260703fa76bb92f144b527b3d55289568db74.tar.gz forums-8a4260703fa76bb92f144b527b3d55289568db74.tar.bz2 forums-8a4260703fa76bb92f144b527b3d55289568db74.tar.xz forums-8a4260703fa76bb92f144b527b3d55289568db74.zip  | |
[ticket/11495] Fix some docs and replace branch with other terms
PHPBB3-11495
| -rw-r--r-- | phpBB/includes/tree/interface.php | 20 | ||||
| -rw-r--r-- | phpBB/includes/tree/nestedset.php | 24 | ||||
| -rw-r--r-- | tests/tree/nestedset_forum_get_data_test.php | 24 | 
3 files changed, 34 insertions, 34 deletions
diff --git a/phpBB/includes/tree/interface.php b/phpBB/includes/tree/interface.php index ed0ccca3f1..1b462768a0 100644 --- a/phpBB/includes/tree/interface.php +++ b/phpBB/includes/tree/interface.php @@ -28,12 +28,12 @@ interface phpbb_tree_interface  	/**  	* Delete an item from the tree and from the database table  	* -	* Also deletes all subitems from the tree and from the database table +	* Also deletes the subtree from the tree and from the database table  	*  	* @param int	$item_id	The item to be deleted  	* @return array		Item ids that have been deleted  	*/ -	public function delete($item); +	public function delete($item_id);  	/**  	* Move an item by a given delta @@ -79,16 +79,16 @@ interface phpbb_tree_interface  	/**  	* Change parent item  	* -	* Moves the item to the bottom of the new parent's list of children +	* Moves the item to the bottom of the new parent's subtree  	*  	* @param int	$item_id			The item to be moved  	* @param int	$new_parent_id		The new parent item  	* @return bool True if the parent was set successfully  	*/ -	public function change_parent($item, $new_parent_id); +	public function change_parent($item_id, $new_parent_id);  	/** -	* Get children and parent branch of the item +	* Get all items that are either a parent or part of the subtree of the item  	*  	* @param int		$item_id		The item id to get the parents/children from  	* @param bool		$order_desc		Order the items descending (most outer parent first) @@ -96,10 +96,10 @@ interface phpbb_tree_interface  	* @return array			Array of items (containing all columns from the item table)  	*							ID => Item data  	*/ -	public function get_full_branch_data($item_id, $order_desc, $include_item); +	public function get_path_and_subtree_data($item_id, $order_desc, $include_item);  	/** -	* Get parent branch of the item +	* Get all parent items of the item  	*  	* @param int		$item_id		The item id to get the parents from  	* @param bool		$order_desc		Order the items descending (most outer parent first) @@ -107,10 +107,10 @@ interface phpbb_tree_interface  	* @return array			Array of items (containing all columns from the item table)  	*							ID => Item data  	*/ -	public function get_parent_branch_data($item_id, $order_desc, $include_item); +	public function get_path_data($item_id, $order_desc, $include_item);  	/** -	* Get children branch of the item +	* Get all items of the item's subtree  	*  	* @param int		$item_id		The item id to get the children from  	* @param bool		$order_desc		Order the items descending (most outer parent first) @@ -118,7 +118,7 @@ interface phpbb_tree_interface  	* @return array			Array of items (containing all columns from the item table)  	*							ID => Item data  	*/ -	public function get_children_branch_data($item_id, $order_desc, $include_item); +	public function get_subtree_data($item_id, $order_desc, $include_item);  	/**  	* Get base information of parent items diff --git a/phpBB/includes/tree/nestedset.php b/phpBB/includes/tree/nestedset.php index 9655a08aa5..10ab6a86e3 100644 --- a/phpBB/includes/tree/nestedset.php +++ b/phpBB/includes/tree/nestedset.php @@ -154,7 +154,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface  	*/  	protected function remove_item_from_nestedset($item_id)  	{ -		$items = $this->get_children_branch_data($item_id); +		$items = $this->get_subtree_data($item_id);  		$item_ids = array_keys($items);  		$this->remove_subset($item_ids, $items[$item_id]); @@ -338,7 +338,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface  			throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');  		} -		$item_data = $this->get_children_branch_data($current_parent_id); +		$item_data = $this->get_subtree_data($current_parent_id);  		if (!isset($item_data[$current_parent_id]))  		{  			$this->lock->release(); @@ -447,7 +447,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface  			throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');  		} -		$item_data = $this->get_children_branch_data($item_id); +		$item_data = $this->get_subtree_data($item_id);  		if (!isset($item_data[$item_id]))  		{  			$this->lock->release(); @@ -529,45 +529,45 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface  	/**  	* @inheritdoc  	*/ -	public function get_full_branch_data($item_id, $order_desc = true, $include_item = true) +	public function get_path_and_subtree_data($item_id, $order_desc = true, $include_item = true)  	{  		$condition = 'i2.' . $this->column_left_id . ' BETWEEN i1.' . $this->column_left_id . ' AND i1.' . $this->column_right_id . '  			OR i1.' . $this->column_left_id . ' BETWEEN i2.' . $this->column_left_id . ' AND i2.' . $this->column_right_id; -		return $this->get_branch_data($item_id, $condition, $order_desc, $include_item); +		return $this->get_set_of_nodes_data($item_id, $condition, $order_desc, $include_item);  	}  	/**  	* @inheritdoc  	*/ -	public function get_parent_branch_data($item_id, $order_desc = true, $include_item = true) +	public function get_path_data($item_id, $order_desc = true, $include_item = true)  	{  		$condition = 'i1.' . $this->column_left_id . ' BETWEEN i2.' . $this->column_left_id . ' AND i2.' . $this->column_right_id . ''; -		return $this->get_branch_data($item_id, $condition, $order_desc, $include_item); +		return $this->get_set_of_nodes_data($item_id, $condition, $order_desc, $include_item);  	}  	/**  	* @inheritdoc  	*/ -	public function get_children_branch_data($item_id, $order_desc = true, $include_item = true) +	public function get_subtree_data($item_id, $order_desc = true, $include_item = true)  	{  		$condition = 'i2.' . $this->column_left_id . ' BETWEEN i1.' . $this->column_left_id . ' AND i1.' . $this->column_right_id . ''; -		return $this->get_branch_data($item_id, $condition, $order_desc, $include_item); +		return $this->get_set_of_nodes_data($item_id, $condition, $order_desc, $include_item);  	}  	/** -	* Get children and parent branch of the item +	* Get items that are related to the given item by the condition  	* -	* @param int		$item_id		The item id to get the parents/children from +	* @param int		$item_id		The item id to get the node set from  	* @param string		$condition		Query string restricting the item list  	* @param bool		$order_desc		Order the items descending (most outer parent first)  	* @param bool		$include_item	Should the item (matching the given item id) be included in the list aswell  	* @return array			Array of items (containing all columns from the item table)  	*							ID => Item data  	*/ -	protected function get_branch_data($item_id, $condition, $order_desc = true, $include_item = true) +	protected function get_set_of_nodes_data($item_id, $condition, $order_desc = true, $include_item = true)  	{  		$rows = array(); diff --git a/tests/tree/nestedset_forum_get_data_test.php b/tests/tree/nestedset_forum_get_data_test.php index 71c1d8bf8a..300bbc6bfa 100644 --- a/tests/tree/nestedset_forum_get_data_test.php +++ b/tests/tree/nestedset_forum_get_data_test.php @@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/nestedset_forum_base.php';  class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_nestedset_forum_base  { -	public function get_full_branch_data_data() +	public function get_path_and_subtree_data_data()  	{  		return array(  			array(1, true, true, array(1, 2, 3)), @@ -32,14 +32,14 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne  	}  	/** -	* @dataProvider get_full_branch_data_data +	* @dataProvider get_path_and_subtree_data_data  	*/ -	public function test_get_full_branch_data($forum_id, $order_desc, $include_item, $expected) +	public function test_get_path_and_subtree_data($forum_id, $order_desc, $include_item, $expected)  	{ -		$this->assertEquals($expected, array_keys($this->set->get_full_branch_data($forum_id, $order_desc, $include_item))); +		$this->assertEquals($expected, array_keys($this->set->get_path_and_subtree_data($forum_id, $order_desc, $include_item)));  	} -	public function get_parent_branch_data_data() +	public function get_path_data_data()  	{  		return array(  			array(1, true, true, array(1)), @@ -60,14 +60,14 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne  	}  	/** -	* @dataProvider get_parent_branch_data_data +	* @dataProvider get_path_data_data  	*/ -	public function test_get_parent_branch_data($forum_id, $order_desc, $include_item, $expected) +	public function test_get_path_data($forum_id, $order_desc, $include_item, $expected)  	{ -		$this->assertEquals($expected, array_keys($this->set->get_parent_branch_data($forum_id, $order_desc, $include_item))); +		$this->assertEquals($expected, array_keys($this->set->get_path_data($forum_id, $order_desc, $include_item)));  	} -	public function get_children_branch_data_data() +	public function get_subtree_data_data()  	{  		return array(  			array(1, true, true, array(1, 2, 3)), @@ -88,11 +88,11 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne  	}  	/** -	* @dataProvider get_children_branch_data_data +	* @dataProvider get_subtree_data_data  	*/ -	public function test_get_children_branch_data($forum_id, $order_desc, $include_item, $expected) +	public function test_get_subtree_data($forum_id, $order_desc, $include_item, $expected)  	{ -		$this->assertEquals($expected, array_keys($this->set->get_children_branch_data($forum_id, $order_desc, $include_item))); +		$this->assertEquals($expected, array_keys($this->set->get_subtree_data($forum_id, $order_desc, $include_item)));  	}  	public function get_parent_data_data()  | 
