Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Server_Reflection_Node Class Reference

Public Member Functions

 __construct ($value, Zend_Server_Reflection_Node $parent=null)
 
 setParent (Zend_Server_Reflection_Node $node, $new=false)
 
 createChild ($value)
 
 attachChild (Zend_Server_Reflection_Node $node)
 
 getChildren ()
 
 hasChildren ()
 
 getParent ()
 
 getValue ()
 
 setValue ($value)
 
 getEndPoints ()
 

Protected Attributes

 $_value = null
 
 $_children = array()
 
 $_parent = null
 

Detailed Description

Definition at line 31 of file Node.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $value,
Zend_Server_Reflection_Node  $parent = null 
)

Constructor

Parameters
mixed$value
Zend_Server_Reflection_Node$parentOptional
Returns
Zend_Server_Reflection_Node

Definition at line 58 of file Node.php.

59  {
60  $this->_value = $value;
61  if (null !== $parent) {
62  $this->setParent($parent, true);
63  }
64 
65  return $this;
66  }
$value
Definition: gender.phtml:16
setParent(Zend_Server_Reflection_Node $node, $new=false)
Definition: Node.php:76

Member Function Documentation

◆ attachChild()

attachChild ( Zend_Server_Reflection_Node  $node)

Attach a child node

Parameters
Zend_Server_Reflection_Node$node
Returns
void

Definition at line 106 of file Node.php.

107  {
108  $this->_children[] = $node;
109 
110  if ($node->getParent() !== $this) {
111  $node->setParent($this);
112  }
113  }
setParent(Zend_Server_Reflection_Node $node, $new=false)
Definition: Node.php:76

◆ createChild()

createChild (   $value)

Create and attach a new child node

Parameters
mixed$value@access public
Returns
Zend_Server_Reflection_Node New child node

Definition at line 93 of file Node.php.

94  {
95  $child = new self($value, $this);
96 
97  return $child;
98  }
$value
Definition: gender.phtml:16

◆ getChildren()

getChildren ( )

Return an array of all child nodes

Returns
array

Definition at line 120 of file Node.php.

121  {
122  return $this->_children;
123  }

◆ getEndPoints()

getEndPoints ( )

Retrieve the bottommost nodes of this node's tree

Retrieves the bottommost nodes of the tree by recursively calling getEndPoints() on all children. If a child is null, it returns the parent as an end point.

Returns
array

Definition at line 175 of file Node.php.

176  {
177  $endPoints = array();
178  if (!$this->hasChildren()) {
179  return $endPoints;
180  }
181 
182  foreach ($this->_children as $child) {
183  $value = $child->getValue();
184 
185  if (null === $value) {
186  $endPoints[] = $this;
187  } elseif ((null !== $value)
188  && $child->hasChildren())
189  {
190  $childEndPoints = $child->getEndPoints();
191  if (!empty($childEndPoints)) {
192  $endPoints = array_merge($endPoints, $childEndPoints);
193  }
194  } elseif ((null !== $value) && !$child->hasChildren()) {
195  $endPoints[] = $child;
196  }
197  }
198 
199  return $endPoints;
200  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$value
Definition: gender.phtml:16

◆ getParent()

getParent ( )

Return the parent node

Returns
null|Zend_Server_Reflection_Node

Definition at line 140 of file Node.php.

141  {
142  return $this->_parent;
143  }

◆ getValue()

getValue ( )

Return the node's current value

Returns
mixed

Definition at line 150 of file Node.php.

151  {
152  return $this->_value;
153  }

◆ hasChildren()

hasChildren ( )

Does this node have children?

Returns
boolean

Definition at line 130 of file Node.php.

131  {
132  return count($this->_children) > 0;
133  }

◆ setParent()

setParent ( Zend_Server_Reflection_Node  $node,
  $new = false 
)

Set parent node

Parameters
Zend_Server_Reflection_Node$node
boolean$newWhether or not the child node is newly created and should always be attached
Returns
void

Definition at line 76 of file Node.php.

77  {
78  $this->_parent = $node;
79 
80  if ($new) {
81  $node->attachChild($this);
82  return;
83  }
84  }
attachChild(Zend_Server_Reflection_Node $node)
Definition: Node.php:106

◆ setValue()

setValue (   $value)

Set the node value

Parameters
mixed$value
Returns
void

Definition at line 161 of file Node.php.

162  {
163  $this->_value = $value;
164  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $_children

$_children = array()
protected

Definition at line 43 of file Node.php.

◆ $_parent

$_parent = null
protected

Definition at line 49 of file Node.php.

◆ $_value

$_value = null
protected

Definition at line 37 of file Node.php.


The documentation for this class was generated from the following file: