Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Element.php
Go to the documentation of this file.
1 <?php
30 abstract class Zend_Pdf_Element
31 {
32  const TYPE_BOOL = 1;
33  const TYPE_NUMERIC = 2;
34  const TYPE_STRING = 3;
35  const TYPE_NAME = 4;
36  const TYPE_ARRAY = 5;
37  const TYPE_DICTIONARY = 6;
38  const TYPE_STREAM = 7;
39  const TYPE_NULL = 11;
40 
46  private $_parentObject = null;
47 
54  abstract public function getType();
55 
65  abstract public function toString($factory = null);
66 
67  const CLONE_MODE_SKIP_PAGES = 1; // Do not follow pages during deep copy process
68  const CLONE_MODE_FORCE_CLONING = 2; // Force top level object cloning even it's already processed
69 
81  public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
82  {
83  return clone $this;
84  }
85 
91  public function setParentObject(Zend_Pdf_Element_Object $parent)
92  {
93  $this->_parentObject = $parent;
94  }
95 
96 
102  public function getParentObject()
103  {
104  return $this->_parentObject;
105  }
106 
107 
114  public function touch()
115  {
116  if ($this->_parentObject !== null) {
117  $this->_parentObject->touch();
118  }
119  }
120 
124  public function cleanUp()
125  {
126  // Do nothing
127  }
128 
134  public function toPhp()
135  {
136  return $this->value;
137  }
138 
145  public static function phpToPdf($input)
146  {
147  if (is_numeric($input)) {
148  #require_once 'Zend/Pdf/Element/Numeric.php';
149  return new Zend_Pdf_Element_Numeric($input);
150  } else if (is_bool($input)) {
151  #require_once 'Zend/Pdf/Element/Boolean.php';
152  return new Zend_Pdf_Element_Boolean($input);
153  } else if (is_array($input)) {
154  $pdfElementsArray = array();
155  $isDictionary = false;
156 
157  foreach ($input as $key => $value) {
158  if (is_string($key)) {
159  $isDictionary = true;
160  }
161  $pdfElementsArray[$key] = Zend_Pdf_Element::phpToPdf($value);
162  }
163 
164  if ($isDictionary) {
165  #require_once 'Zend/Pdf/Element/Dictionary.php';
166  return new Zend_Pdf_Element_Dictionary($pdfElementsArray);
167  } else {
168  #require_once 'Zend/Pdf/Element/Array.php';
169  return new Zend_Pdf_Element_Array($pdfElementsArray);
170  }
171  } else {
172  #require_once 'Zend/Pdf/Element/String.php';
173  return new Zend_Pdf_Element_String((string)$input);
174  }
175  }
176 }
const TYPE_BOOL
Definition: Element.php:32
const TYPE_STREAM
Definition: Element.php:38
const TYPE_NAME
Definition: Element.php:35
const TYPE_NUMERIC
Definition: Element.php:33
const TYPE_ARRAY
Definition: Element.php:36
makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
Definition: Element.php:81
const TYPE_DICTIONARY
Definition: Element.php:37
toString($factory=null)
static phpToPdf($input)
Definition: Element.php:145
$value
Definition: gender.phtml:16
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
const TYPE_NULL
Definition: Element.php:39
const CLONE_MODE_FORCE_CLONING
Definition: Element.php:68
const TYPE_STRING
Definition: Element.php:34
setParentObject(Zend_Pdf_Element_Object $parent)
Definition: Element.php:91
const CLONE_MODE_SKIP_PAGES
Definition: Element.php:67