Skip to content

Commit 8f183a4

Browse files
committed
Initial commit
0 parents  commit 8f183a4

File tree

13 files changed

+1493
-0
lines changed

13 files changed

+1493
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.buildpath
2+
/.cache
3+
/.metadata
4+
/.project
5+
/.settings
6+
/.vscode
7+
/.idea
8+
/.gitattributes
9+
.DS_Store

LICENSE.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2005-2015, Zend Technologies USA, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of Zend Technologies USA, Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from this
16+
software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
INFORMATION
2+
===================
3+
4+
This is a fork from Zend Framework 1.12.16 Release.
5+
6+
PURPOSE
7+
---------------------------
8+
This package is a part of the Zend Framework 1. Component was separated and put into its own composer package.
9+
10+
LICENSE
11+
=======
12+
13+
The files in this archive are released under the Zend Framework license.
14+
You can find a copy of this license in [LICENSE.txt](LICENSE.txt).

composer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "magento/zend-memory",
3+
"description": "Magento Zend Framework 1",
4+
"type": "library",
5+
"keywords": [
6+
"framework",
7+
"zf1"
8+
],
9+
"homepage": "http://framework.zend.com/",
10+
"license": "BSD-3-Clause",
11+
"require": {
12+
"php": ">=7.0.0",
13+
"magento/zend-cache": "^1.16",
14+
"magento/zend-exception": "^1.16"
15+
},
16+
"autoload": {
17+
"psr-0": {
18+
"Zend_Db": "library/"
19+
}
20+
},
21+
"extra": {
22+
"branch-alias": {
23+
"dev-main": "1.16.x-dev"
24+
}
25+
}
26+
}

library/Zend/Memory.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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_Memory
17+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
18+
* @license http://framework.zend.com/license/new-bsd New BSD License
19+
* @version $Id$
20+
*/
21+
22+
/** Zend_Memory_Exception */
23+
#require_once 'Zend/Memory/Manager.php';
24+
25+
/** Zend_Memory_Value */
26+
#require_once 'Zend/Memory/Value.php';
27+
28+
/** Zend_Memory_Container */
29+
#require_once 'Zend/Memory/Container.php';
30+
31+
/** Zend_Memory_Exception */
32+
#require_once 'Zend/Cache.php';
33+
34+
/**
35+
* @category Zend
36+
* @package Zend_Memory
37+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
38+
* @license http://framework.zend.com/license/new-bsd New BSD License
39+
*/
40+
class Zend_Memory
41+
{
42+
/**
43+
* Factory
44+
*
45+
* @param string $backend backend name
46+
* @param array $backendOptions associative array of options for the corresponding backend constructor
47+
* @return Zend_Memory_Manager
48+
* @throws Zend_Memory_Exception
49+
*/
50+
public static function factory($backend, $backendOptions = array())
51+
{
52+
if (strcasecmp($backend, 'none') == 0) {
53+
return new Zend_Memory_Manager();
54+
}
55+
56+
// Look through available backendsand
57+
// (that allows to specify it in any case)
58+
$backendIsFound = false;
59+
foreach (Zend_Cache::$standardBackends as $zendCacheBackend) {
60+
if (strcasecmp($backend, $zendCacheBackend) == 0) {
61+
$backend = $zendCacheBackend;
62+
$backendIsFound = true;
63+
break;
64+
}
65+
}
66+
67+
if (!$backendIsFound) {
68+
#require_once 'Zend/Memory/Exception.php';
69+
throw new Zend_Memory_Exception("Incorrect backend ($backend)");
70+
}
71+
72+
$backendClass = 'Zend_Cache_Backend_' . $backend;
73+
74+
// For perfs reasons, we do not use the Zend_Loader::loadClass() method
75+
// (security controls are explicit)
76+
#require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
77+
78+
$backendObject = new $backendClass($backendOptions);
79+
80+
return new Zend_Memory_Manager($backendObject);
81+
}
82+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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_Memory
17+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
18+
* @license http://framework.zend.com/license/new-bsd New BSD License
19+
* @version $Id$
20+
*/
21+
22+
/**
23+
* Zend_Memory_Container_Interface
24+
*/
25+
#require_once 'Zend/Memory/Container/Interface.php';
26+
27+
/**
28+
* Memory object container access controller.
29+
*
30+
* Memory manager stores a list of generated objects to control them.
31+
* So container objects always have at least one reference and can't be automatically destroyed.
32+
*
33+
* This class is intended to be an userland proxy to memory container object.
34+
* It's not referenced by memory manager and class destructor is invoked immidiately after gouing
35+
* out of scope or unset operation.
36+
*
37+
* Class also provides Zend_Memory_Container_Interface interface and works as proxy for such cases.
38+
*
39+
* @category Zend
40+
* @package Zend_Memory
41+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
42+
* @license http://framework.zend.com/license/new-bsd New BSD License
43+
*/
44+
class Zend_Memory_AccessController implements Zend_Memory_Container_Interface
45+
{
46+
/**
47+
* Memory container object
48+
*
49+
* @var Zend_Memory_Container
50+
*/
51+
private $_memContainer;
52+
53+
54+
/**
55+
* Object constructor
56+
*
57+
* @param Zend_Memory_Container_Movable $memoryManager
58+
*/
59+
public function __construct(Zend_Memory_Container_Movable $memContainer)
60+
{
61+
$this->_memContainer = $memContainer;
62+
}
63+
64+
/**
65+
* Object destructor
66+
*/
67+
public function __destruct()
68+
{
69+
$this->_memContainer->destroy();
70+
}
71+
72+
73+
/**
74+
* Get string value reference
75+
*
76+
* _Must_ be used for value access before PHP v 5.2
77+
* or _may_ be used for performance considerations
78+
*
79+
* @return &string
80+
*/
81+
public function &getRef()
82+
{
83+
return $this->_memContainer->getRef();
84+
}
85+
86+
/**
87+
* Signal, that value is updated by external code.
88+
*
89+
* Should be used together with getRef()
90+
*/
91+
public function touch()
92+
{
93+
$this->_memContainer->touch();
94+
}
95+
96+
/**
97+
* Lock object in memory.
98+
*/
99+
public function lock()
100+
{
101+
$this->_memContainer->lock();
102+
}
103+
104+
105+
/**
106+
* Unlock object
107+
*/
108+
public function unlock()
109+
{
110+
$this->_memContainer->unlock();
111+
}
112+
113+
/**
114+
* Return true if object is locked
115+
*
116+
* @return boolean
117+
*/
118+
public function isLocked()
119+
{
120+
return $this->_memContainer->isLocked();
121+
}
122+
123+
/**
124+
* Get handler
125+
*
126+
* Loads object if necessary and moves it to the top of loaded objects list.
127+
* Swaps objects from the bottom of loaded objects list, if necessary.
128+
*
129+
* @param string $property
130+
* @return string
131+
* @throws Zend_Memory_Exception
132+
*/
133+
public function __get($property)
134+
{
135+
return $this->_memContainer->$property;
136+
}
137+
138+
/**
139+
* Set handler
140+
*
141+
* @param string $property
142+
* @param string $value
143+
* @throws Zend_Exception
144+
*/
145+
public function __set($property, $value)
146+
{
147+
$this->_memContainer->$property = $value;
148+
}
149+
}

library/Zend/Memory/Container.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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_Memory
17+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
18+
* @license http://framework.zend.com/license/new-bsd New BSD License
19+
* @version $Id$
20+
*/
21+
22+
/** Zend_Memory_Container_Interface */
23+
#require_once 'Zend/Memory/Container/Interface.php';
24+
25+
/**
26+
* Memory value container
27+
*
28+
* @category Zend
29+
* @package Zend_Memory
30+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
31+
* @license http://framework.zend.com/license/new-bsd New BSD License
32+
*/
33+
abstract class Zend_Memory_Container implements Zend_Memory_Container_Interface
34+
{
35+
}

0 commit comments

Comments
 (0)