Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Array.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Element.php';
25 
26 
36 {
44  public $items;
45 
46 
53  public function __construct($val = null)
54  {
55  $this->items = new ArrayObject();
56 
57  if ($val !== null && is_array($val)) {
58  foreach ($val as $element) {
59  if (!$element instanceof Zend_Pdf_Element) {
60  #require_once 'Zend/Pdf/Exception.php';
61  throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
62  }
63  $this->items[] = $element;
64  }
65  } else if ($val !== null){
66  #require_once 'Zend/Pdf/Exception.php';
67  throw new Zend_Pdf_Exception('Argument must be an array');
68  }
69  }
70 
71 
78  public function __get($property) {
79  #require_once 'Zend/Pdf/Exception.php';
80  throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
81  }
82 
83 
91  public function __set($property, $value) {
92  #require_once 'Zend/Pdf/Exception.php';
93  throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
94  }
95 
101  public function getType()
102  {
104  }
105 
106 
113  public function toString($factory = null)
114  {
115  $outStr = '[';
116  $lastNL = 0;
117 
118  foreach ($this->items as $element) {
119  if (strlen($outStr) - $lastNL > 128) {
120  $outStr .= "\n";
121  $lastNL = strlen($outStr);
122  }
123 
124  $outStr .= $element->toString($factory) . ' ';
125  }
126  $outStr .= ']';
127 
128  return $outStr;
129  }
130 
139  public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
140  {
141  $newArray = new self();
142 
143  foreach ($this->items as $key => $value) {
144  $newArray->items[$key] = $value->makeClone($factory, $processed, $mode);
145  }
146 
147  return $newArray;
148  }
149 
155  public function setParentObject(Zend_Pdf_Element_Object $parent)
156  {
157  parent::setParentObject($parent);
158 
159  foreach ($this->items as $item) {
160  $item->setParentObject($parent);
161  }
162  }
163 
171  public function toPhp()
172  {
173  $phpArray = array();
174 
175  foreach ($this->items as $item) {
176  $phpArray[] = $item->toPhp();
177  }
178 
179  return $phpArray;
180  }
181 }
makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
Definition: Array.php:139
__construct($val=null)
Definition: Array.php:53
const TYPE_ARRAY
Definition: Element.php:36
__set($property, $value)
Definition: Array.php:91
toString($factory=null)
Definition: Array.php:113
setParentObject(Zend_Pdf_Element_Object $parent)
Definition: Array.php:155
$value
Definition: gender.phtml:16
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15
__get($property)
Definition: Array.php:78
$element
Definition: element.phtml:12