Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GoTo.php
Go to the documentation of this file.
1 <?php
24 #require_once 'Zend/Pdf/Destination.php';
25 
26 #require_once 'Zend/Pdf/Element/Dictionary.php';
27 #require_once 'Zend/Pdf/Element/Name.php';
28 
29 
31 #require_once 'Zend/Pdf/Action.php';
32 
42 {
48  protected $_destination;
49 
50 
57  public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
58  {
59  parent::__construct($dictionary, $processedActions);
60 
61  $this->_destination = Zend_Pdf_Destination::load($dictionary->D);
62  }
63 
70  public static function create($destination)
71  {
72  if (is_string($destination)) {
73  #require_once 'Zend/Pdf/Destination/Named.php';
74  $destination = Zend_Pdf_Destination_Named::create($destination);
75  }
76 
77  if (!$destination instanceof Zend_Pdf_Destination) {
78  #require_once 'Zend/Pdf/Exception.php';
79  throw new Zend_Pdf_Exception('$destination parameter must be a Zend_Pdf_Destination object or string.');
80  }
81 
82  $dictionary = new Zend_Pdf_Element_Dictionary();
83  $dictionary->Type = new Zend_Pdf_Element_Name('Action');
84  $dictionary->S = new Zend_Pdf_Element_Name('GoTo');
85  $dictionary->Next = null;
86  $dictionary->D = $destination->getResource();
87 
88  return new Zend_Pdf_Action_GoTo($dictionary, new SplObjectStorage());
89  }
90 
97  public function setDestination(Zend_Pdf_Destination $destination)
98  {
99  $this->_destination = $destination;
100 
101  $this->_actionDictionary->touch();
102  $this->_actionDictionary->D = $destination->getResource();
103 
104  return $this;
105  }
106 
112  public function getDestination()
113  {
114  return $this->_destination;
115  }
116 }
setDestination(Zend_Pdf_Destination $destination)
Definition: GoTo.php:97
static create($name)
Definition: Named.php:76
static create($destination)
Definition: GoTo.php:70
static load(Zend_Pdf_Element $resource)
Definition: Destination.php:49
__construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
Definition: GoTo.php:57