Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Resource.php
Go to the documentation of this file.
1 <?php
30 abstract class Zend_Pdf_Resource
31 {
50  protected $_objectFactory;
51 
57  protected $_resource;
58 
67  public function __construct($resource)
68  {
69  if ($resource instanceof Zend_Pdf_Element_Object) {
70  $this->_objectFactory = $resource->getFactory();
71  $this->_resource = $resource;
72 
73  return;
74  }
75 
76  #require_once 'Zend/Pdf/ElementFactory.php';
77 
78  $this->_objectFactory = Zend_Pdf_ElementFactory::createFactory(1);
79  if ($resource instanceof Zend_Pdf_Element) {
80  $this->_resource = $this->_objectFactory->newObject($resource);
81  } else {
82  $this->_resource = $this->_objectFactory->newStreamObject($resource);
83  }
84  }
85 
90  public function __clone()
91  {
94 // $factory = Zend_Pdf_ElementFactory::createFactory(1);
95 // $processed = array();
96 //
97 // // Clone dictionary object.
98 // // Do it explicitly to prevent sharing resource attributes between different
99 // // results of clone operation (other resources are still shared)
100 // $dictionary = new Zend_Pdf_Element_Dictionary();
101 // foreach ($this->_pageDictionary->getKeys() as $key) {
102 // $dictionary->$key = $this->_pageDictionary->$key->makeClone($factory->getFactory(),
103 // $processed,
104 // Zend_Pdf_Element::CLONE_MODE_SKIP_PAGES);
105 // }
106 //
107 // $this->_pageDictionary = $factory->newObject($dictionary);
108 // $this->_objectFactory = $factory;
109 // $this->_attached = false;
110 // $this->_style = null;
111 // $this->_font = null;
112  }
113 
123  public function cloneResource($factory, &$processed)
124  {
127 // // Clone dictionary object.
128 // // Do it explicitly to prevent sharing page attributes between different
129 // // results of clonePage() operation (other resources are still shared)
130 // $dictionary = new Zend_Pdf_Element_Dictionary();
131 // foreach ($this->_pageDictionary->getKeys() as $key) {
132 // $dictionary->$key = $this->_pageDictionary->$key->makeClone($factory->getFactory(),
133 // $processed,
134 // Zend_Pdf_Element::CLONE_MODE_SKIP_PAGES);
135 // }
136 //
137 // $clonedPage = new Zend_Pdf_Page($factory->newObject($dictionary), $factory);
138 // $clonedPage->_attached = false;
139 //
140 // return $clonedPage;
141  }
142 
150  public function getResource()
151  {
152  return $this->_resource;
153  }
154 
161  public function getFactory()
162  {
163  return $this->_objectFactory;
164  }
165 }
$resource
Definition: bulk.php:12
__construct($resource)
Definition: Resource.php:67
cloneResource($factory, &$processed)
Definition: Resource.php:123
static createFactory($objCount)