1 <?php
2 /**
3 * @package Joomla.Legacy
4 * @subpackage Base
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Tree Class.
14 *
15 * @since 1.5
16 * @deprecated 3.0
17 */
18 class JTree extends JObject
19 {
20 /**
21 * Root node
22 *
23 * @var JNode
24 * @since 1.5
25 * @deprecated 3.0
26 */
27 protected $_root = null;
28
29 /**
30 * Current working node
31 *
32 * @var JNode
33 * @since 1.5
34 * @deprecated 3.0
35 */
36 protected $_current = null;
37
38 /**
39 * Constructor
40 *
41 * @since 1.5
42 * @deprecated 3.0
43 */
44 public function __construct()
45 {
46 JLog::add('JTree::__construct() is deprecated.', JLog::WARNING, 'deprecated');
47
48 $this->_root = new JNode('ROOT');
49 $this->_current = & $this->_root;
50 }
51
52 /**
53 * Method to add a child
54 *
55 * @param array &$node The node to process
56 * @param boolean $setCurrent True to set as current working node
57 *
58 * @return void
59 *
60 * @since 1.5
61 * @deprecated 3.0
62 */
63 public function addChild(&$node, $setCurrent = false)
64 {
65 JLog::add('JTree::addChild() is deprecated.', JLog::WARNING, 'deprecated');
66
67 $this->_current->addChild($node);
68
69 if ($setCurrent)
70 {
71 $this->_current = &$node;
72 }
73 }
74
75 /**
76 * Method to get the parent
77 *
78 * @return void
79 *
80 * @since 1.5
81 * @deprecated 3.0
82 */
83 public function getParent()
84 {
85 JLog::add('JTree::getParent() is deprecated.', JLog::WARNING, 'deprecated');
86
87 $this->_current = &$this->_current->getParent();
88 }
89
90 /**
91 * Method to get the parent
92 *
93 * @return void
94 *
95 * @since 1.5
96 * @deprecated 3.0
97 */
98 public function reset()
99 {
100 JLog::add('JTree::reset() is deprecated.', JLog::WARNING, 'deprecated');
101
102 $this->_current = &$this->_root;
103 }
104 }
105