File indexing completed on 2024-12-22 05:36:57

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Pdf
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 
0023 /**
0024  * Container which collects updated object info.
0025  *
0026  * @package    Zend_Pdf
0027  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0028  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0029  */
0030 class Zend_Pdf_UpdateInfoContainer
0031 {
0032     /**
0033      * Object number
0034      *
0035      * @var integer
0036      */
0037     private $_objNum;
0038 
0039     /**
0040      * Generation number
0041      *
0042      * @var integer
0043      */
0044     private $_genNum;
0045 
0046 
0047     /**
0048      * Flag, which signals, that object is free
0049      *
0050      * @var boolean
0051      */
0052     private $_isFree;
0053 
0054     /**
0055      * String representation of the object
0056      *
0057      * @var Zend_Memory_Container|null
0058      */
0059     private $_dump = null;
0060 
0061     /**
0062      * Object constructor
0063      *
0064      * @param integer $objCount
0065      */
0066     public function __construct($objNum, $genNum, $isFree, $dump = null)
0067     {
0068         $this->_objNum = $objNum;
0069         $this->_genNum = $genNum;
0070         $this->_isFree = $isFree;
0071 
0072         if ($dump !== null) {
0073             if (strlen($dump) > 1024) {
0074                 // require_once 'Zend/Pdf.php';
0075                 $this->_dump = Zend_Pdf::getMemoryManager()->create($dump);
0076             } else {
0077                 $this->_dump = $dump;
0078             }
0079         }
0080     }
0081 
0082 
0083     /**
0084      * Get object number
0085      *
0086      * @return integer
0087      */
0088     public function getObjNum()
0089     {
0090         return $this->_objNum;
0091     }
0092 
0093     /**
0094      * Get generation number
0095      *
0096      * @return integer
0097      */
0098     public function getGenNum()
0099     {
0100         return $this->_genNum;
0101     }
0102 
0103     /**
0104      * Check, that object is free
0105      *
0106      * @return boolean
0107      */
0108     public function isFree()
0109     {
0110         return $this->_isFree;
0111     }
0112 
0113     /**
0114      * Get string representation of the object
0115      *
0116      * @return string
0117      */
0118     public function getObjectDump()
0119     {
0120         if ($this->_dump === null) {
0121             return '';
0122         }
0123 
0124         if (is_string($this->_dump)) {
0125             return $this->_dump;
0126         }
0127 
0128         return $this->_dump->getRef();
0129     }
0130 }
0131