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

Public Member Functions

 __construct (Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
 
 getFactory ()
 
 getType ()
 
 getObjNum ()
 
 getGenNum ()
 
 toString ($factory=null)
 
 dump (Zend_Pdf_ElementFactory $factory)
 
 __get ($property)
 
 __set ($property, $value)
 
 __call ($method, $args)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 touch ()
 
 getObject ()
 
 cleanUp ()
 
 toPhp ()
 
- Public Member Functions inherited from Zend_Pdf_Element
 getType ()
 
 toString ($factory=null)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 setParentObject (Zend_Pdf_Element_Object $parent)
 
 getParentObject ()
 
 touch ()
 
 cleanUp ()
 
 toPhp ()
 

Protected Attributes

 $_value
 
 $_objNum
 
 $_genNum
 
 $_factory
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Pdf_Element
static phpToPdf ($input)
 
- Data Fields inherited from Zend_Pdf_Element
const TYPE_BOOL = 1
 
const TYPE_NUMERIC = 2
 
const TYPE_STRING = 3
 
const TYPE_NAME = 4
 
const TYPE_ARRAY = 5
 
const TYPE_DICTIONARY = 6
 
const TYPE_STREAM = 7
 
const TYPE_NULL = 11
 
const CLONE_MODE_SKIP_PAGES = 1
 
const CLONE_MODE_FORCE_CLONING = 2
 

Detailed Description

Definition at line 35 of file Object.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Pdf_Element  $val,
  $objNum,
  $genNum,
Zend_Pdf_ElementFactory  $factory 
)

Object constructor

Parameters
Zend_Pdf_Element$val
integer$objNum
integer$genNum
Zend_Pdf_ElementFactory$factory
Exceptions
Zend_Pdf_Exception

Definition at line 74 of file Object.php.

75  {
76  if ($val instanceof self) {
77  #require_once 'Zend/Pdf/Exception.php';
78  throw new Zend_Pdf_Exception('Object number must not be an instance of Zend_Pdf_Element_Object.');
79  }
80 
81  if ( !(is_integer($objNum) && $objNum > 0) ) {
82  #require_once 'Zend/Pdf/Exception.php';
83  throw new Zend_Pdf_Exception('Object number must be positive integer.');
84  }
85 
86  if ( !(is_integer($genNum) && $genNum >= 0) ) {
87  #require_once 'Zend/Pdf/Exception.php';
88  throw new Zend_Pdf_Exception('Generation number must be non-negative integer.');
89  }
90 
91  $this->_value = $val;
92  $this->_objNum = $objNum;
93  $this->_genNum = $genNum;
94  $this->_factory = $factory;
95 
96  $this->setParentObject($this);
97 
98  $factory->registerObject($this, $objNum . ' ' . $genNum);
99  }
setParentObject(Zend_Pdf_Element_Object $parent)
Definition: Element.php:91

Member Function Documentation

◆ __call()

__call (   $method,
  $args 
)

Call handler

Parameters
string$method
array$args
Returns
mixed

Definition at line 209 of file Object.php.

210  {
211  return call_user_func_array(array($this->_value, $method), $args);
212  }
$method
Definition: info.phtml:13

◆ __get()

__get (   $property)

Get handler

Parameters
string$property
Returns
mixed

Definition at line 186 of file Object.php.

187  {
188  return $this->_value->$property;
189  }

◆ __set()

__set (   $property,
  $value 
)

Set handler

Parameters
string$property
mixed$value

Definition at line 197 of file Object.php.

198  {
199  $this->_value->$property = $value;
200  }
$value
Definition: gender.phtml:16

◆ cleanUp()

cleanUp ( )

Clean up resources, used by object

Definition at line 270 of file Object.php.

271  {
272  $this->_value = null;
273  }

◆ dump()

dump ( Zend_Pdf_ElementFactory  $factory)

Dump object to a string to save within PDF file.

$factory parameter defines operation context.

Parameters
Zend_Pdf_ElementFactory$factory
Returns
string

Definition at line 171 of file Object.php.

172  {
173  $shift = $factory->getEnumerationShift($this->_factory);
174 
175  return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
176  . $this->_value->toString($factory) . "\n"
177  . "endobj\n";
178  }

◆ getFactory()

getFactory ( )

Check, that object is generated by specified factory

Returns
Zend_Pdf_ElementFactory

Definition at line 107 of file Object.php.

108  {
109  return $this->_factory;
110  }

◆ getGenNum()

getGenNum ( )

Get generation number

Returns
integer

Definition at line 139 of file Object.php.

140  {
141  return $this->_genNum;
142  }

◆ getObject()

getObject ( )

Return object, which can be used to identify object and its references identity

Returns
Zend_Pdf_Element_Object

Definition at line 262 of file Object.php.

263  {
264  return $this;
265  }

◆ getObjNum()

getObjNum ( )

Get object number

Returns
integer

Definition at line 128 of file Object.php.

129  {
130  return $this->_objNum;
131  }

◆ getType()

getType ( )

Return type of the element.

Returns
integer

Definition at line 117 of file Object.php.

118  {
119  return $this->_value->getType();
120  }

◆ makeClone()

makeClone ( Zend_Pdf_ElementFactory  $factory,
array &  $processed,
  $mode 
)

Detach PDF object from the factory (if applicable), clone it and attach to new factory.

Parameters
Zend_Pdf_ElementFactory$factoryThe factory to attach
array&$processedList of already processed indirect objects, used to avoid objects duplication
integer$modeCloning mode (defines filter for objects cloning)
Returns
Zend_Pdf_Element

Definition at line 222 of file Object.php.

223  {
224  $id = spl_object_hash($this);
225  if (isset($processed[$id])) {
226  // Do nothing if object is already processed
227  // return it
228  return $processed[$id];
229  }
230 
231  // Create obect with null value and register it in $processed container
232  $processed[$id] = $clonedObject = $factory->newObject(new Zend_Pdf_Element_Null());
233 
234  // Pecursively process actual data
235  $clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
236 
237  if ($clonedObject->_value instanceof Zend_Pdf_Element_Null) {
238  // Do not store null objects within $processed container since it may be filtered
239  // by $mode parameter but used in some future pass
240  unset($processed[$id]);
241 
242  // Return direct null object
243  return $clonedObject->_value;
244  }
245 
246  return $clonedObject;
247  }
$id
Definition: fieldset.phtml:14
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15

◆ toPhp()

toPhp ( )

Convert PDF element to PHP type.

Returns
mixed

Definition at line 280 of file Object.php.

281  {
282  return $this->_value->toPhp();
283  }

◆ toString()

toString (   $factory = null)

Return reference to the object

Parameters
Zend_Pdf_Factory$factory
Returns
string

Definition at line 151 of file Object.php.

152  {
153  if ($factory === null) {
154  $shift = 0;
155  } else {
156  $shift = $factory->getEnumerationShift($this->_factory);
157  }
158 
159  return $this->_objNum + $shift . ' ' . $this->_genNum . ' R';
160  }

◆ touch()

touch ( )

Mark object as modified, to include it into new PDF file segment

Definition at line 252 of file Object.php.

253  {
254  $this->_factory->markAsModified($this);
255  }

Field Documentation

◆ $_factory

$_factory
protected

Definition at line 63 of file Object.php.

◆ $_genNum

$_genNum
protected

Definition at line 56 of file Object.php.

◆ $_objNum

$_objNum
protected

Definition at line 49 of file Object.php.

◆ $_value

$_value
protected

Definition at line 42 of file Object.php.


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