Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Zend_Pdf_Element_Reference_Table Class Reference

Public Member Functions

 __construct ()
 
 addReference ($ref, $offset, $inuse=true)
 
 setParent (self $parent)
 
 getOffset ($ref)
 
 getNextFree ($ref)
 
 getNewGeneration ($objNum)
 

Detailed Description

Definition at line 31 of file Table.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Object constructor

Definition at line 77 of file Table.php.

78  {
79  $this->_parent = null;
80  $this->_free = array(); $this->_generations = array();
81  $this->_inuse = array(); $this->_usedObjects = array();
82  }

Member Function Documentation

◆ addReference()

addReference (   $ref,
  $offset,
  $inuse = true 
)

Add reference to the reference table

Parameters
string$ref
integer$offset
boolean$inuse

Definition at line 92 of file Table.php.

93  {
94  $refElements = explode(' ', $ref);
95  if (!is_numeric($refElements[0]) || !is_numeric($refElements[1]) || $refElements[2] != 'R') {
96  #require_once 'Zend/Pdf/Exception.php';
97  throw new Zend_Pdf_Exception("Incorrect reference: '$ref'");
98  }
99  $objNum = (int)$refElements[0];
100  $genNum = (int)$refElements[1];
101 
102  if ($inuse) {
103  $this->_inuse[$ref] = $offset;
104  $this->_usedObjects[$objNum] = $objNum;
105  } else {
106  $this->_free[$ref] = $offset;
107  $this->_generations[$objNum] = $genNum;
108  }
109  }

◆ getNewGeneration()

getNewGeneration (   $objNum)

Get next generation number for free object

Parameters
integer$objNum
Returns
unknown

Definition at line 180 of file Table.php.

181  {
182  if (isset($this->_usedObjects[$objNum])) {
183  #require_once 'Zend/Pdf/Exception.php';
184  throw new Zend_Pdf_Exception('Object is not free');
185  }
186 
187  if (isset($this->_generations[$objNum])) {
188  return $this->_generations[$objNum];
189  }
190 
191  if (isset($this->_parent)) {
192  return $this->_parent->getNewGeneration($objNum);
193  }
194 
195  #require_once 'Zend/Pdf/Exception.php';
196  throw new Zend_Pdf_Exception('Object not found.');
197  }

◆ getNextFree()

getNextFree (   $ref)

Get next object from a list of free objects.

Parameters
string$ref
Returns
integer
Exceptions
Zend_Pdf_Exception

Definition at line 154 of file Table.php.

155  {
156  if (isset($this->_inuse[$ref])) {
157  #require_once 'Zend/Pdf/Exception.php';
158  throw new Zend_Pdf_Exception('Object is not free');
159  }
160 
161  if (isset($this->_free[$ref])) {
162  return $this->_free[$ref];
163  }
164 
165  if (isset($this->_parent)) {
166  return $this->_parent->getNextFree($ref);
167  }
168 
169  #require_once 'Zend/Pdf/Exception.php';
170  throw new Zend_Pdf_Exception('Object not found.');
171  }

◆ getOffset()

getOffset (   $ref)

Get object offset

Parameters
string$ref
Returns
integer

Definition at line 129 of file Table.php.

130  {
131  if (isset($this->_inuse[$ref])) {
132  return $this->_inuse[$ref];
133  }
134 
135  if (isset($this->_free[$ref])) {
136  return null;
137  }
138 
139  if (isset($this->_parent)) {
140  return $this->_parent->getOffset($ref);
141  }
142 
143  return null;
144  }

◆ setParent()

setParent ( self  $parent)

Set parent reference table

Parameters
Zend_Pdf_Element_Reference_Table$parent

Definition at line 117 of file Table.php.

118  {
119  $this->_parent = $parent;
120  }

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