Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Outline.php
Go to the documentation of this file.
1 <?php
34 abstract class Zend_Pdf_Outline implements RecursiveIterator, Countable
35 {
41  protected $_open = false;
42 
48  public $childOutlines = array();
49 
50 
56  abstract public function getTitle();
57 
64  abstract public function setTitle($title);
65 
71  public function isOpen()
72  {
73  return $this->_open;
74  }
75 
82  public function setIsOpen($isOpen)
83  {
84  $this->_open = $isOpen;
85  return $this;
86  }
87 
93  abstract public function isItalic();
94 
101  abstract public function setIsItalic($isItalic);
102 
108  abstract public function isBold();
109 
116  abstract public function setIsBold($isBold);
117 
118 
124  abstract public function getColor();
125 
133  abstract public function setColor(Zend_Pdf_Color_Rgb $color);
134 
140  abstract public function getTarget();
141 
149  abstract public function setTarget($target = null);
150 
156  public function getOptions()
157  {
158  return array('title' => $this->_title,
159  'open' => $this->_open,
160  'color' => $this->_color,
161  'italic' => $this->_italic,
162  'bold' => $this->_bold,
163  'target' => $this->_target);
164  }
165 
173  public function setOptions(array $options)
174  {
175  foreach ($options as $key => $value) {
176  switch ($key) {
177  case 'title':
178  $this->setTitle($value);
179  break;
180 
181  case 'open':
182  $this->setIsOpen($value);
183  break;
184 
185  case 'color':
186  $this->setColor($value);
187  break;
188  case 'italic':
189  $this->setIsItalic($value);
190  break;
191 
192  case 'bold':
193  $this->setIsBold($value);
194  break;
195 
196  case 'target':
197  $this->setTarget($value);
198  break;
199 
200  default:
201  #require_once 'Zend/Pdf/Exception.php';
202  throw new Zend_Pdf_Exception("Unknown option name - '$key'.");
203  break;
204  }
205  }
206 
207  return $this;
208  }
209 
230  public static function create($param1, $param2 = null)
231  {
232  #require_once 'Zend/Pdf/Outline/Created.php';
233  if (is_string($param1)) {
234  if ($param2 !== null && !($param2 instanceof Zend_Pdf_Target || is_string($param2))) {
235  #require_once 'Zend/Pdf/Exception.php';
236  throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $target (Zend_Pdf_Target or string) or an array as an input');
237  }
238 
239  return new Zend_Pdf_Outline_Created(array('title' => $param1,
240  'target' => $param2));
241  } else {
242  if (!is_array($param1) || $param2 !== null) {
243  #require_once 'Zend/Pdf/Exception.php';
244  throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $destination (Zend_Pdf_Destination) or an array as an input');
245  }
246 
247  return new Zend_Pdf_Outline_Created($param1);
248  }
249  }
250 
257  public function openOutlinesCount()
258  {
259  $count = 1; // Include this outline
260 
261  if ($this->isOpen()) {
262  foreach ($this->childOutlines as $child) {
263  $count += $child->openOutlinesCount();
264  }
265  }
266 
267  return $count;
268  }
269 
282  abstract public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
283  $updateNavigation,
284  Zend_Pdf_Element $parent,
285  Zend_Pdf_Element $prev = null,
286  SplObjectStorage $processedOutlines = null);
287 
288 
290  // RecursiveIterator interface methods
292 
298  public function current()
299  {
300  return current($this->childOutlines);
301  }
302 
308  public function key()
309  {
310  return key($this->childOutlines);
311  }
312 
316  public function next()
317  {
318  return next($this->childOutlines);
319  }
320 
324  public function rewind()
325  {
326  return reset($this->childOutlines);
327  }
328 
334  public function valid()
335  {
336  return current($this->childOutlines) !== false;
337  }
338 
344  public function getChildren()
345  {
346  return current($this->childOutlines);
347  }
348 
354  public function hasChildren()
355  {
356  return count($this->childOutlines) > 0;
357  }
358 
359 
361  // Countable interface methods
363 
369  public function count()
370  {
371  return count($this->childOutlines);
372  }
373 }
$title
Definition: default.phtml:14
setIsOpen($isOpen)
Definition: Outline.php:82
static create($param1, $param2=null)
Definition: Outline.php:230
$count
Definition: recent.phtml:13
$target
Definition: skip.phtml:8
setIsItalic($isItalic)
setTarget($target=null)
setOptions(array $options)
Definition: Outline.php:173
$value
Definition: gender.phtml:16
setIsBold($isBold)
dumpOutline(Zend_Pdf_ElementFactory_Interface $factory, $updateNavigation, Zend_Pdf_Element $parent, Zend_Pdf_Element $prev=null, SplObjectStorage $processedOutlines=null)
setColor(Zend_Pdf_Color_Rgb $color)