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

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_Memory
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 /** Zend_Memory_Container */
0023 // require_once 'Zend/Memory/Container.php';
0024 
0025 /**
0026  * Memory value container
0027  *
0028  * Locked (always stored in memory).
0029  *
0030  * @category   Zend
0031  * @package    Zend_Memory
0032  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0033  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0034  */
0035 class Zend_Memory_Container_Locked extends Zend_Memory_Container
0036 {
0037     /**
0038      * Value object
0039      *
0040      * @var string
0041      */
0042     public $value;
0043 
0044 
0045     /**
0046      * Object constructor
0047      *
0048      * @param Zend_Memory_Manager $memoryManager
0049      * @param integer $id
0050      * @param string $value
0051      */
0052     public function __construct($value)
0053     {
0054         $this->value = $value;
0055     }
0056 
0057     /**
0058      * Lock object in memory.
0059      */
0060     public function lock()
0061     {
0062         /* Do nothing */
0063     }
0064 
0065     /**
0066      * Unlock object
0067      */
0068     public function unlock()
0069     {
0070         /* Do nothing */
0071     }
0072 
0073     /**
0074      * Return true if object is locked
0075      *
0076      * @return boolean
0077      */
0078     public function isLocked()
0079     {
0080         return true;
0081     }
0082 
0083     /**
0084      * Get string value reference
0085      *
0086      * _Must_ be used for value access before PHP v 5.2
0087      * or _may_ be used for performance considerations
0088      *
0089      * @return &string
0090      */
0091     public function &getRef()
0092     {
0093         return $this->value;
0094     }
0095 
0096     /**
0097      * Signal, that value is updated by external code.
0098      *
0099      * Should be used together with getRef()
0100      */
0101     public function touch()
0102     {
0103         /* Do nothing */
0104     }
0105 
0106     /**
0107      * Destroy memory container and remove it from memory manager list
0108      */
0109     public function destroy()
0110     {
0111         /* Do nothing */
0112     }
0113 }