Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Zend_Pdf_Element_Dictionary Class Reference
Inheritance diagram for Zend_Pdf_Element_Dictionary:
Zend_Pdf_Element

Public Member Functions

 __construct ($val=null)
 
Zend_Pdf_Element_Name $name

Add element to an array

Parameters
Zend_Pdf_Element$val- Zend_Pdf_Element object
Exceptions
Zend_Pdf_Exception
 add (Zend_Pdf_Element_Name $name, Zend_Pdf_Element $val)
 
 getKeys ()
 
 __get ($item)
 
 __set ($item, $value)
 
 getType ()
 
 toString ($factory=null)
 
 makeClone (Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
 
 setParentObject (Zend_Pdf_Element_Object $parent)
 
 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 ()
 

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 38 of file Dictionary.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $val = null)

Object constructor

Parameters
array$val- array of Zend_Pdf_Element objects
Exceptions
Zend_Pdf_Exception

Definition at line 55 of file Dictionary.php.

56  {
57  if ($val === null) {
58  return;
59  } else if (!is_array($val)) {
60  #require_once 'Zend/Pdf/Exception.php';
61  throw new Zend_Pdf_Exception('Argument must be an array');
62  }
63 
64  foreach ($val as $name => $element) {
65  if (!$element instanceof Zend_Pdf_Element) {
66  #require_once 'Zend/Pdf/Exception.php';
67  throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
68  }
69  if (!is_string($name)) {
70  #require_once 'Zend/Pdf/Exception.php';
71  throw new Zend_Pdf_Exception('Array keys must be strings');
72  }
73  $this->_items[$name] = $element;
74  }
75  }
if(!isset($_GET['name'])) $name
Definition: log.php:14
$element
Definition: element.phtml:12

Member Function Documentation

◆ __get()

__get (   $item)

Get handler

Parameters
string$property
Returns
Zend_Pdf_Element | null

Definition at line 107 of file Dictionary.php.

108  {
109  $element = isset($this->_items[$item]) ? $this->_items[$item]
110  : null;
111 
112  return $element;
113  }
$element
Definition: element.phtml:12

◆ __set()

__set (   $item,
  $value 
)

Set handler

Parameters
string$property
mixed$value

Definition at line 121 of file Dictionary.php.

122  {
123  if ($value === null) {
124  unset($this->_items[$item]);
125  } else {
126  $this->_items[$item] = $value;
127  }
128  }
$value
Definition: gender.phtml:16

◆ add()

add ( Zend_Pdf_Element_Name  $name,
Zend_Pdf_Element  $val 
)

Definition at line 85 of file Dictionary.php.

86  {
87  $this->_items[$name->value] = $val;
88  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ getKeys()

getKeys ( )

Return dictionary keys

Returns
array

Definition at line 95 of file Dictionary.php.

96  {
97  return array_keys($this->_items);
98  }

◆ getType()

getType ( )

Return type of the element.

Returns
integer

Definition at line 135 of file Dictionary.php.

136  {
138  }
const TYPE_DICTIONARY
Definition: Element.php:37

◆ 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
Exceptions
Zend_Pdf_Exception

Definition at line 180 of file Dictionary.php.

181  {
182  if (isset($this->_items['Type'])) {
183  if ($this->_items['Type']->value == 'Pages') {
184  // It's a page tree node
185  // skip it and its children
186  return new Zend_Pdf_Element_Null();
187  }
188 
189  if ($this->_items['Type']->value == 'Page' &&
191  ) {
192  // It's a page node, skip it
193  return new Zend_Pdf_Element_Null();
194  }
195  }
196 
197  $newDictionary = new self();
198  foreach ($this->_items as $key => $value) {
199  $newDictionary->_items[$key] = $value->makeClone($factory, $processed, $mode);
200  }
201 
202  return $newDictionary;
203  }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
$value
Definition: gender.phtml:16
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
const CLONE_MODE_SKIP_PAGES
Definition: Element.php:67

◆ setParentObject()

setParentObject ( Zend_Pdf_Element_Object  $parent)

Set top level parent indirect object.

Parameters
Zend_Pdf_Element_Object$parent

Definition at line 210 of file Dictionary.php.

211  {
212  parent::setParentObject($parent);
213 
214  foreach ($this->_items as $item) {
215  $item->setParentObject($parent);
216  }
217  }

◆ toPhp()

toPhp ( )

Convert PDF element to PHP type.

Dictionary is returned as an associative array

Returns
mixed

Definition at line 226 of file Dictionary.php.

227  {
228  $phpArray = array();
229 
230  foreach ($this->_items as $itemName => $item) {
231  $phpArray[$itemName] = $item->toPhp();
232  }
233 
234  return $phpArray;
235  }

◆ toString()

toString (   $factory = null)

Return object as string

Parameters
Zend_Pdf_Factory$factory
Returns
string

Definition at line 147 of file Dictionary.php.

148  {
149  $outStr = '<<';
150  $lastNL = 0;
151 
152  foreach ($this->_items as $name => $element) {
153  if (!is_object($element)) {
154  #require_once 'Zend/Pdf/Exception.php';
155  throw new Zend_Pdf_Exception('Wrong data');
156  }
157 
158  if (strlen($outStr) - $lastNL > 128) {
159  $outStr .= "\n";
160  $lastNL = strlen($outStr);
161  }
162 
163  $nameObj = new Zend_Pdf_Element_Name($name);
164  $outStr .= $nameObj->toString($factory) . ' ' . $element->toString($factory) . ' ';
165  }
166  $outStr .= '>>';
167 
168  return $outStr;
169  }
if(!isset($_GET['name'])) $name
Definition: log.php:14
$element
Definition: element.phtml:12

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