示例#1
0
 /**
  * Detach PDF object from the factory (if applicable), clone it and attach to new factory.
  *
  * @param \ZendPdf\ObjectFactory $factory  The factory to attach
  * @param array &$processed  List of already processed indirect objects, used to avoid objects duplication
  * @param integer $mode  Cloning mode (defines filter for objects cloning)
  * @returns \ZendPdf\InternalType\AbstractTypeObject
  */
 public function makeClone(ObjectFactory $factory, array &$processed, $mode)
 {
     $id = spl_object_hash($this);
     if (isset($processed[$id])) {
         // Do nothing if object is already processed
         // return it
         return $processed[$id];
     }
     $streamValue = $this->_value;
     $streamDictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
     // Make new empty instance of stream object and register it in $processed container
     $processed[$id] = $clonedObject = $factory->newStreamObject('');
     // Copy current object data and state
     $clonedObject->_dictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
     $clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
     $clonedObject->_initialDictionaryData = $this->_initialDictionaryData;
     $clonedObject->_streamDecoded = $this->_streamDecoded;
     return $clonedObject;
 }