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

Public Member Functions

 __construct (Zend_Pdf_Element $rootDictionary)
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 clear ()
 
 count ()
 

Protected Attributes

 $_items = array()
 

Detailed Description

Definition at line 36 of file NameTree.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Pdf_Element  $rootDictionary)

Object constructor

Parameters
Zend_Pdf_Element$rootDictionaryroot of name dictionary

Definition at line 51 of file NameTree.php.

52  {
53  if ($rootDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
54  #require_once 'Zend/Pdf/Exception.php';
55  throw new Zend_Pdf_Exception('Name tree root must be a dictionary.');
56  }
57 
58  $intermediateNodes = array();
59  $leafNodes = array();
60  if ($rootDictionary->Kids !== null) {
61  $intermediateNodes[] = $rootDictionary;
62  } else {
63  $leafNodes[] = $rootDictionary;
64  }
65 
66  while (count($intermediateNodes) != 0) {
67  $newIntermediateNodes = array();
68  foreach ($intermediateNodes as $node) {
69  foreach ($node->Kids->items as $childNode) {
70  if ($childNode->Kids !== null) {
71  $newIntermediateNodes[] = $childNode;
72  } else {
73  $leafNodes[] = $childNode;
74  }
75  }
76  }
77  $intermediateNodes = $newIntermediateNodes;
78  }
79 
80  foreach ($leafNodes as $leafNode) {
81  $destinationsCount = count($leafNode->Names->items)/2;
82  for ($count = 0; $count < $destinationsCount; $count++) {
83  $this->_items[$leafNode->Names->items[$count*2]->value] = $leafNode->Names->items[$count*2 + 1];
84  }
85  }
86  }
$count
Definition: recent.phtml:13
const TYPE_DICTIONARY
Definition: Element.php:37

Member Function Documentation

◆ clear()

clear ( )

Definition at line 145 of file NameTree.php.

146  {
147  $this->_items = array();
148  }

◆ count()

count ( )

Definition at line 150 of file NameTree.php.

151  {
152  return count($this->_items);
153  }

◆ current()

current ( )

Definition at line 88 of file NameTree.php.

89  {
90  return current($this->_items);
91  }

◆ key()

key ( )

Definition at line 100 of file NameTree.php.

101  {
102  return key($this->_items);
103  }

◆ next()

next ( )

Definition at line 94 of file NameTree.php.

95  {
96  return next($this->_items);
97  }

◆ offsetExists()

offsetExists (   $offset)

Definition at line 117 of file NameTree.php.

118  {
119  return array_key_exists($offset, $this->_items);
120  }

◆ offsetGet()

offsetGet (   $offset)

Definition at line 123 of file NameTree.php.

124  {
125  return $this->_items[$offset];
126  }

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

Definition at line 129 of file NameTree.php.

130  {
131  if ($offset === null) {
132  $this->_items[] = $value;
133  } else {
134  $this->_items[$offset] = $value;
135  }
136  }
$value
Definition: gender.phtml:16

◆ offsetUnset()

offsetUnset (   $offset)

Definition at line 139 of file NameTree.php.

140  {
141  unset($this->_items[$offset]);
142  }

◆ rewind()

rewind ( )

Definition at line 111 of file NameTree.php.

112  {
113  reset($this->_items);
114  }

◆ valid()

valid ( )

Definition at line 106 of file NameTree.php.

106  {
107  return current($this->_items)!==false;
108  }

Field Documentation

◆ $_items

$_items = array()
protected

Definition at line 44 of file NameTree.php.


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