PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.3
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorageFactory.php +66 -46 3.1.23.0.3 View file →
@@ -1,10 +1,10 @@
1 1 <?php
2 2
3 3 /**
4 - * PHPExcel_CachedObjectStorageFactory
4 + * PHPExcel
5 5 *
6 - * Copyright (c) 2006 - 2015 PHPExcel
6 + * Copyright (c) 2006 - 2014 PHPExcel
7 7 *
8 8 * This library is free software; you can redistribute it and/or
9 9 * modify it under the terms of the GNU Lesser General Public
10 10 * License as published by the Free Software Foundation; either
@@ -20,12 +20,21 @@
20 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21 *
22 22 * @category PHPExcel
23 23 * @package PHPExcel_CachedObjectStorage
24 - * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
25 25 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
26 26 * @version ##VERSION##, ##DATE##
27 27 */
28 +
29 +
30 +/**
31 + * PHPExcel_CachedObjectStorageFactory
32 + *
33 + * @category PHPExcel
34 + * @package PHPExcel_CachedObjectStorage
35 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
36 + */
28 37 class PHPExcel_CachedObjectStorageFactory
29 38 {
30 39 const cache_in_memory = 'Memory';
31 40 const cache_in_memory_gzip = 'MemoryGZip';
@@ -38,14 +47,15 @@
38 47 const cache_to_wincache = 'Wincache';
39 48 const cache_to_sqlite = 'SQLite';
40 49 const cache_to_sqlite3 = 'SQLite3';
41 50
51 +
42 52 /**
43 53 * Name of the method used for cell cacheing
44 54 *
45 55 * @var string
46 56 */
47 - private static $cacheStorageMethod = null;
57 + private static $_cacheStorageMethod = NULL;
48 58
49 59 /**
50 60 * Name of the class used for cell cacheing
51 61 *
@@ -50,16 +60,17 @@
50 60 * Name of the class used for cell cacheing
51 61 *
52 62 * @var string
53 63 */
54 - private static $cacheStorageClass = null;
64 + private static $_cacheStorageClass = NULL;
55 65
66 +
56 67 /**
57 68 * List of all possible cache storage methods
58 69 *
59 70 * @var string[]
60 71 */
61 - private static $storageMethods = array(
72 + private static $_storageMethods = array(
62 73 self::cache_in_memory,
63 74 self::cache_in_memory_gzip,
64 75 self::cache_in_memory_serialized,
65 76 self::cache_igbinary,
@@ -71,14 +82,15 @@
71 82 self::cache_to_sqlite,
72 83 self::cache_to_sqlite3,
73 84 );
74 85
86 +
75 87 /**
76 88 * Default arguments for each cache storage method
77 89 *
78 90 * @var array of mixed array
79 91 */
80 - private static $storageMethodDefaultParameters = array(
92 + private static $_storageMethodDefaultParameters = array(
81 93 self::cache_in_memory => array(
82 94 ),
83 95 self::cache_in_memory_gzip => array(
84 96 ),
@@ -87,9 +99,9 @@
87 99 self::cache_igbinary => array(
88 100 ),
89 101 self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
90 102 ),
91 - self::cache_to_discISAM => array( 'dir' => null
103 + self::cache_to_discISAM => array( 'dir' => NULL
92 104 ),
93 105 self::cache_to_apc => array( 'cacheTime' => 600
94 106 ),
95 107 self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
@@ -103,35 +115,39 @@
103 115 self::cache_to_sqlite3 => array(
104 116 ),
105 117 );
106 118
119 +
107 120 /**
108 121 * Arguments for the active cache storage method
109 122 *
110 123 * @var array of mixed array
111 124 */
112 - private static $storageMethodParameters = array();
125 + private static $_storageMethodParameters = array();
113 126
127 +
114 128 /**
115 129 * Return the current cache storage method
116 130 *
117 - * @return string|null
131 + * @return string|NULL
118 132 **/
119 133 public static function getCacheStorageMethod()
120 134 {
121 - return self::$cacheStorageMethod;
122 - }
135 + return self::$_cacheStorageMethod;
136 + } // function getCacheStorageMethod()
123 137
138 +
124 139 /**
125 140 * Return the current cache storage class
126 141 *
127 - * @return PHPExcel_CachedObjectStorage_ICache|null
142 + * @return PHPExcel_CachedObjectStorage_ICache|NULL
128 143 **/
129 144 public static function getCacheStorageClass()
130 145 {
131 - return self::$cacheStorageClass;
132 - }
146 + return self::$_cacheStorageClass;
147 + } // function getCacheStorageClass()
133 148
149 +
134 150 /**
135 151 * Return the list of all possible cache storage methods
136 152 *
137 153 * @return string[]
@@ -137,11 +153,12 @@
137 153 * @return string[]
138 154 **/
139 155 public static function getAllCacheStorageMethods()
140 156 {
141 - return self::$storageMethods;
142 - }
157 + return self::$_storageMethods;
158 + } // function getCacheStorageMethods()
143 159
160 +
144 161 /**
145 162 * Return the list of all available cache storage methods
146 163 *
147 164 * @return string[]
@@ -148,9 +165,9 @@
148 165 **/
149 166 public static function getCacheStorageMethods()
150 167 {
151 168 $activeMethods = array();
152 - foreach (self::$storageMethods as $storageMethod) {
169 + foreach(self::$_storageMethods as $storageMethod) {
153 170 $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
154 171 if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
155 172 $activeMethods[] = $storageMethod;
156 173 }
@@ -155,10 +172,11 @@
155 172 $activeMethods[] = $storageMethod;
156 173 }
157 174 }
158 175 return $activeMethods;
159 - }
176 + } // function getCacheStorageMethods()
160 177
178 +
161 179 /**
162 180 * Identify the cache storage method to use
163 181 *
164 182 * @param string $method Name of the method to use for cell cacheing
@@ -167,32 +185,33 @@
167 185 * @return boolean
168 186 **/
169 187 public static function initialize($method = self::cache_in_memory, $arguments = array())
170 188 {
171 - if (!in_array($method, self::$storageMethods)) {
172 - return false;
189 + if (!in_array($method,self::$_storageMethods)) {
190 + return FALSE;
173 191 }
174 192
175 193 $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
176 194 if (!call_user_func(array( $cacheStorageClass,
177 195 'cacheMethodIsAvailable'))) {
178 - return false;
196 + return FALSE;
179 197 }
180 198
181 - self::$storageMethodParameters[$method] = self::$storageMethodDefaultParameters[$method];
182 - foreach ($arguments as $k => $v) {
183 - if (array_key_exists($k, self::$storageMethodParameters[$method])) {
184 - self::$storageMethodParameters[$method][$k] = $v;
199 + self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method];
200 + foreach($arguments as $k => $v) {
201 + if (array_key_exists($k, self::$_storageMethodParameters[$method])) {
202 + self::$_storageMethodParameters[$method][$k] = $v;
185 203 }
186 204 }
187 205
188 - if (self::$cacheStorageMethod === null) {
189 - self::$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
190 - self::$cacheStorageMethod = $method;
206 + if (self::$_cacheStorageMethod === NULL) {
207 + self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
208 + self::$_cacheStorageMethod = $method;
191 209 }
192 - return true;
193 - }
210 + return TRUE;
211 + } // function initialize()
194 212
213 +
195 214 /**
196 215 * Initialise the cache storage
197 216 *
198 217 * @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
@@ -199,33 +218,34 @@
199 218 * @return PHPExcel_CachedObjectStorage_ICache
200 219 **/
201 220 public static function getInstance(PHPExcel_Worksheet $parent)
202 221 {
203 - $cacheMethodIsAvailable = true;
204 - if (self::$cacheStorageMethod === null) {
222 + $cacheMethodIsAvailable = TRUE;
223 + if (self::$_cacheStorageMethod === NULL) {
205 224 $cacheMethodIsAvailable = self::initialize();
206 225 }
207 226
208 227 if ($cacheMethodIsAvailable) {
209 - $instance = new self::$cacheStorageClass(
210 - $parent,
211 - self::$storageMethodParameters[self::$cacheStorageMethod]
212 - );
213 - if ($instance !== null) {
228 + $instance = new self::$_cacheStorageClass( $parent,
229 + self::$_storageMethodParameters[self::$_cacheStorageMethod]
230 + );
231 + if ($instance !== NULL) {
214 232 return $instance;
215 233 }
216 234 }
217 235
218 - return false;
219 - }
236 + return FALSE;
237 + } // function getInstance()
220 238
239 +
221 240 /**
222 241 * Clear the cache storage
223 242 *
224 243 **/
225 - public static function finalize()
226 - {
227 - self::$cacheStorageMethod = null;
228 - self::$cacheStorageClass = null;
229 - self::$storageMethodParameters = array();
230 - }
244 + public static function finalize()
245 + {
246 + self::$_cacheStorageMethod = NULL;
247 + self::$_cacheStorageClass = NULL;
248 + self::$_storageMethodParameters = array();
249 + }
250 +
231 251 }