web/lib/Zend/Pdf/UpdateInfoContainer.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Pdf
       
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: UpdateInfoContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  */
       
    21 
       
    22 
       
    23 /**
       
    24  * Container which collects updated object info.
       
    25  *
       
    26  * @package    Zend_Pdf
       
    27  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    28  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    29  */
       
    30 class Zend_Pdf_UpdateInfoContainer
       
    31 {
       
    32     /**
       
    33      * Object number
       
    34      *
       
    35      * @var integer
       
    36      */
       
    37     private $_objNum;
       
    38 
       
    39     /**
       
    40      * Generation number
       
    41      *
       
    42      * @var integer
       
    43      */
       
    44     private $_genNum;
       
    45 
       
    46 
       
    47     /**
       
    48      * Flag, which signals, that object is free
       
    49      *
       
    50      * @var boolean
       
    51      */
       
    52     private $_isFree;
       
    53 
       
    54     /**
       
    55      * String representation of the object
       
    56      *
       
    57      * @var Zend_Memory_Container|null
       
    58      */
       
    59     private $_dump = null;
       
    60 
       
    61     /**
       
    62      * Object constructor
       
    63      *
       
    64      * @param integer $objCount
       
    65      */
       
    66     public function __construct($objNum, $genNum, $isFree, $dump = null)
       
    67     {
       
    68         $this->_objNum = $objNum;
       
    69         $this->_genNum = $genNum;
       
    70         $this->_isFree = $isFree;
       
    71 
       
    72         if ($dump !== null) {
       
    73             if (strlen($dump) > 1024) {
       
    74                 require_once 'Zend/Pdf.php';
       
    75                 $this->_dump = Zend_Pdf::getMemoryManager()->create($dump);
       
    76             } else {
       
    77                 $this->_dump = $dump;
       
    78             }
       
    79         }
       
    80     }
       
    81 
       
    82 
       
    83     /**
       
    84      * Get object number
       
    85      *
       
    86      * @return integer
       
    87      */
       
    88     public function getObjNum()
       
    89     {
       
    90         return $this->_objNum;
       
    91     }
       
    92 
       
    93     /**
       
    94      * Get generation number
       
    95      *
       
    96      * @return integer
       
    97      */
       
    98     public function getGenNum()
       
    99     {
       
   100         return $this->_genNum;
       
   101     }
       
   102 
       
   103     /**
       
   104      * Check, that object is free
       
   105      *
       
   106      * @return boolean
       
   107      */
       
   108     public function isFree()
       
   109     {
       
   110         return $this->_isFree;
       
   111     }
       
   112 
       
   113     /**
       
   114      * Get string representation of the object
       
   115      *
       
   116      * @return string
       
   117      */
       
   118     public function getObjectDump()
       
   119     {
       
   120         if ($this->_dump === null) {
       
   121             return '';
       
   122         }
       
   123 
       
   124         if (is_string($this->_dump)) {
       
   125             return $this->_dump;
       
   126         }
       
   127 
       
   128         return $this->_dump->getRef();
       
   129     }
       
   130 }
       
   131