@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param string $key |
68 | 68 | * @param array $write_options |
69 | 69 | * |
70 | - * @return bool |
|
70 | + * @return boolean|null |
|
71 | 71 | */ |
72 | 72 | public function delete($key, array $write_options = []){} |
73 | 73 | |
@@ -109,6 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function getSnapshot(){} |
111 | 111 | |
112 | + /** |
|
113 | + * @param string $name |
|
114 | + */ |
|
112 | 115 | static public function destroy($name, array $options = []){} |
113 | 116 | |
114 | 117 | static public function repair($name, array $options = []){} |
@@ -14,148 +14,148 @@ |
||
14 | 14 | |
15 | 15 | class LevelDB{ |
16 | 16 | |
17 | - /** |
|
18 | - * @param string $name Path to database |
|
19 | - * @param array $options |
|
20 | - * @param array $read_options |
|
21 | - * @param array $write_options |
|
22 | - */ |
|
23 | - public function __construct($name, array $options = [ |
|
24 | - 'create_if_missing' => true, // if the specified database does not exist will create a new one |
|
25 | - 'error_if_exists' => false, // if the opened database exists will throw exception |
|
26 | - 'paranoid_checks' => false, |
|
27 | - 'block_cache_size' => 8 * (2 << 20), |
|
28 | - 'write_buffer_size' => 4<<20, |
|
29 | - 'block_size' => 4096, |
|
30 | - 'max_open_files' => 1000, |
|
31 | - 'block_restart_interval' => 16, |
|
32 | - 'compression' => LEVELDB_SNAPPY_COMPRESSION, |
|
33 | - 'comparator' => NULL, // any callable parameter return 0, -1, 1 |
|
34 | - ], array $read_options = [ |
|
35 | - 'verify_check_sum' => false, //may be set to true to force checksum verification of all data that is read from the file system on behalf of a particular read. By default, no such verification is done. |
|
36 | - 'fill_cache' => true, //When performing a bulk read, the application may set this to false to disable the caching so that the data processed by the bulk read does not end up displacing most of the cached contents. |
|
37 | - ], array $write_options = [ |
|
38 | - //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. |
|
39 | - 'sync' => false |
|
40 | - ]){} |
|
41 | - |
|
42 | - /** |
|
43 | - * @param string $key |
|
44 | - * @param array $read_options |
|
45 | - * |
|
46 | - * @return string|bool |
|
47 | - */ |
|
48 | - public function get($key, array $read_options = []){} |
|
49 | - |
|
50 | - /** |
|
51 | - * Alias of LevelDB::put() |
|
52 | - * |
|
53 | - * @param string $key |
|
54 | - * @param string $value |
|
55 | - * @param array $write_options |
|
56 | - */ |
|
57 | - public function set($key, $value, array $write_options = []){} |
|
58 | - |
|
59 | - /** |
|
60 | - * @param string $key |
|
61 | - * @param string $value |
|
62 | - * @param array $write_options |
|
63 | - */ |
|
64 | - public function put($key, $value, array $write_options = []){} |
|
65 | - |
|
66 | - /** |
|
67 | - * @param string $key |
|
68 | - * @param array $write_options |
|
69 | - * |
|
70 | - * @return bool |
|
71 | - */ |
|
72 | - public function delete($key, array $write_options = []){} |
|
73 | - |
|
74 | - /** |
|
75 | - * Executes all of the operations added in the write batch. |
|
76 | - * |
|
77 | - * @param LevelDBWriteBatch $batch |
|
78 | - * @param array $write_options |
|
79 | - */ |
|
80 | - public function write(LevelDBWriteBatch $batch, array $write_options = []){} |
|
81 | - |
|
82 | - /** |
|
83 | - * Valid properties: |
|
84 | - * - leveldb.stats: returns the status of the entire db |
|
85 | - * - leveldb.num-files-at-level: returns the number of files for each level. For example, you can use leveldb.num-files-at-level0 the number of files for zero level. |
|
86 | - * - leveldb.sstables: returns current status of sstables |
|
87 | - * |
|
88 | - * @param string $name |
|
89 | - * |
|
90 | - * @return mixed |
|
91 | - */ |
|
92 | - public function getProperty($name){} |
|
93 | - |
|
94 | - public function getApproximateSizes($start, $limit){} |
|
95 | - |
|
96 | - public function compactRange($start, $limit){} |
|
97 | - |
|
98 | - public function close(){} |
|
99 | - |
|
100 | - /** |
|
101 | - * @param array $options |
|
102 | - * |
|
103 | - * @return LevelDBIterator |
|
104 | - */ |
|
105 | - public function getIterator(array $options = []){} |
|
106 | - |
|
107 | - /** |
|
108 | - * @return LevelDBSnapshot |
|
109 | - */ |
|
110 | - public function getSnapshot(){} |
|
111 | - |
|
112 | - static public function destroy($name, array $options = []){} |
|
113 | - |
|
114 | - static public function repair($name, array $options = []){} |
|
17 | + /** |
|
18 | + * @param string $name Path to database |
|
19 | + * @param array $options |
|
20 | + * @param array $read_options |
|
21 | + * @param array $write_options |
|
22 | + */ |
|
23 | + public function __construct($name, array $options = [ |
|
24 | + 'create_if_missing' => true, // if the specified database does not exist will create a new one |
|
25 | + 'error_if_exists' => false, // if the opened database exists will throw exception |
|
26 | + 'paranoid_checks' => false, |
|
27 | + 'block_cache_size' => 8 * (2 << 20), |
|
28 | + 'write_buffer_size' => 4<<20, |
|
29 | + 'block_size' => 4096, |
|
30 | + 'max_open_files' => 1000, |
|
31 | + 'block_restart_interval' => 16, |
|
32 | + 'compression' => LEVELDB_SNAPPY_COMPRESSION, |
|
33 | + 'comparator' => NULL, // any callable parameter return 0, -1, 1 |
|
34 | + ], array $read_options = [ |
|
35 | + 'verify_check_sum' => false, //may be set to true to force checksum verification of all data that is read from the file system on behalf of a particular read. By default, no such verification is done. |
|
36 | + 'fill_cache' => true, //When performing a bulk read, the application may set this to false to disable the caching so that the data processed by the bulk read does not end up displacing most of the cached contents. |
|
37 | + ], array $write_options = [ |
|
38 | + //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. |
|
39 | + 'sync' => false |
|
40 | + ]){} |
|
41 | + |
|
42 | + /** |
|
43 | + * @param string $key |
|
44 | + * @param array $read_options |
|
45 | + * |
|
46 | + * @return string|bool |
|
47 | + */ |
|
48 | + public function get($key, array $read_options = []){} |
|
49 | + |
|
50 | + /** |
|
51 | + * Alias of LevelDB::put() |
|
52 | + * |
|
53 | + * @param string $key |
|
54 | + * @param string $value |
|
55 | + * @param array $write_options |
|
56 | + */ |
|
57 | + public function set($key, $value, array $write_options = []){} |
|
58 | + |
|
59 | + /** |
|
60 | + * @param string $key |
|
61 | + * @param string $value |
|
62 | + * @param array $write_options |
|
63 | + */ |
|
64 | + public function put($key, $value, array $write_options = []){} |
|
65 | + |
|
66 | + /** |
|
67 | + * @param string $key |
|
68 | + * @param array $write_options |
|
69 | + * |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | + public function delete($key, array $write_options = []){} |
|
73 | + |
|
74 | + /** |
|
75 | + * Executes all of the operations added in the write batch. |
|
76 | + * |
|
77 | + * @param LevelDBWriteBatch $batch |
|
78 | + * @param array $write_options |
|
79 | + */ |
|
80 | + public function write(LevelDBWriteBatch $batch, array $write_options = []){} |
|
81 | + |
|
82 | + /** |
|
83 | + * Valid properties: |
|
84 | + * - leveldb.stats: returns the status of the entire db |
|
85 | + * - leveldb.num-files-at-level: returns the number of files for each level. For example, you can use leveldb.num-files-at-level0 the number of files for zero level. |
|
86 | + * - leveldb.sstables: returns current status of sstables |
|
87 | + * |
|
88 | + * @param string $name |
|
89 | + * |
|
90 | + * @return mixed |
|
91 | + */ |
|
92 | + public function getProperty($name){} |
|
93 | + |
|
94 | + public function getApproximateSizes($start, $limit){} |
|
95 | + |
|
96 | + public function compactRange($start, $limit){} |
|
97 | + |
|
98 | + public function close(){} |
|
99 | + |
|
100 | + /** |
|
101 | + * @param array $options |
|
102 | + * |
|
103 | + * @return LevelDBIterator |
|
104 | + */ |
|
105 | + public function getIterator(array $options = []){} |
|
106 | + |
|
107 | + /** |
|
108 | + * @return LevelDBSnapshot |
|
109 | + */ |
|
110 | + public function getSnapshot(){} |
|
111 | + |
|
112 | + static public function destroy($name, array $options = []){} |
|
113 | + |
|
114 | + static public function repair($name, array $options = []){} |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | class LevelDBIterator implements Iterator{ |
118 | 118 | |
119 | - public function __construct(LevelDB $db, array $read_options = []){} |
|
119 | + public function __construct(LevelDB $db, array $read_options = []){} |
|
120 | 120 | |
121 | - public function valid(){} |
|
121 | + public function valid(){} |
|
122 | 122 | |
123 | - public function rewind(){} |
|
123 | + public function rewind(){} |
|
124 | 124 | |
125 | - public function last(){} |
|
125 | + public function last(){} |
|
126 | 126 | |
127 | - public function seek($key){} |
|
127 | + public function seek($key){} |
|
128 | 128 | |
129 | - public function next(){} |
|
129 | + public function next(){} |
|
130 | 130 | |
131 | - public function prev(){} |
|
131 | + public function prev(){} |
|
132 | 132 | |
133 | - public function key(){} |
|
133 | + public function key(){} |
|
134 | 134 | |
135 | - public function current(){} |
|
135 | + public function current(){} |
|
136 | 136 | |
137 | - public function getError(){} |
|
137 | + public function getError(){} |
|
138 | 138 | |
139 | - public function destroy(){} |
|
139 | + public function destroy(){} |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | 143 | class LevelDBWriteBatch{ |
144 | - public function __construct($name, array $options = [], array $read_options = [], array $write_options = []){} |
|
144 | + public function __construct($name, array $options = [], array $read_options = [], array $write_options = []){} |
|
145 | 145 | |
146 | - public function set($key, $value, array $write_options = []){} |
|
146 | + public function set($key, $value, array $write_options = []){} |
|
147 | 147 | |
148 | - public function put($key, $value, array $write_options = []){} |
|
148 | + public function put($key, $value, array $write_options = []){} |
|
149 | 149 | |
150 | - public function delete($key, array $write_options = []){} |
|
150 | + public function delete($key, array $write_options = []){} |
|
151 | 151 | |
152 | - public function clear(){} |
|
152 | + public function clear(){} |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | class LevelDBSnapshot{ |
156 | - public function __construct(LevelDB $db){} |
|
156 | + public function __construct(LevelDB $db){} |
|
157 | 157 | |
158 | - public function release(){} |
|
158 | + public function release(){} |
|
159 | 159 | |
160 | 160 | } |
161 | 161 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | define("LEVELDB_SNAPPY_COMPRESSION", 1); |
13 | 13 | |
14 | 14 | |
15 | -class LevelDB{ |
|
15 | +class LevelDB { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param string $name Path to database |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'error_if_exists' => false, // if the opened database exists will throw exception |
26 | 26 | 'paranoid_checks' => false, |
27 | 27 | 'block_cache_size' => 8 * (2 << 20), |
28 | - 'write_buffer_size' => 4<<20, |
|
28 | + 'write_buffer_size' => 4 << 20, |
|
29 | 29 | 'block_size' => 4096, |
30 | 30 | 'max_open_files' => 1000, |
31 | 31 | 'block_restart_interval' => 16, |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ], array $write_options = [ |
38 | 38 | //Only one element named sync in the write option array. By default, each write to leveldb is asynchronous. |
39 | 39 | 'sync' => false |
40 | - ]){} |
|
40 | + ]) {} |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @param string $key |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return string|bool |
47 | 47 | */ |
48 | - public function get($key, array $read_options = []){} |
|
48 | + public function get($key, array $read_options = []) {} |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Alias of LevelDB::put() |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * @param string $value |
55 | 55 | * @param array $write_options |
56 | 56 | */ |
57 | - public function set($key, $value, array $write_options = []){} |
|
57 | + public function set($key, $value, array $write_options = []) {} |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @param string $key |
61 | 61 | * @param string $value |
62 | 62 | * @param array $write_options |
63 | 63 | */ |
64 | - public function put($key, $value, array $write_options = []){} |
|
64 | + public function put($key, $value, array $write_options = []) {} |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @param string $key |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
72 | - public function delete($key, array $write_options = []){} |
|
72 | + public function delete($key, array $write_options = []) {} |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Executes all of the operations added in the write batch. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param LevelDBWriteBatch $batch |
78 | 78 | * @param array $write_options |
79 | 79 | */ |
80 | - public function write(LevelDBWriteBatch $batch, array $write_options = []){} |
|
80 | + public function write(LevelDBWriteBatch $batch, array $write_options = []) {} |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Valid properties: |
@@ -89,76 +89,76 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return mixed |
91 | 91 | */ |
92 | - public function getProperty($name){} |
|
92 | + public function getProperty($name) {} |
|
93 | 93 | |
94 | - public function getApproximateSizes($start, $limit){} |
|
94 | + public function getApproximateSizes($start, $limit) {} |
|
95 | 95 | |
96 | - public function compactRange($start, $limit){} |
|
96 | + public function compactRange($start, $limit) {} |
|
97 | 97 | |
98 | - public function close(){} |
|
98 | + public function close() {} |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @param array $options |
102 | 102 | * |
103 | 103 | * @return LevelDBIterator |
104 | 104 | */ |
105 | - public function getIterator(array $options = []){} |
|
105 | + public function getIterator(array $options = []) {} |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * @return LevelDBSnapshot |
109 | 109 | */ |
110 | - public function getSnapshot(){} |
|
110 | + public function getSnapshot() {} |
|
111 | 111 | |
112 | - static public function destroy($name, array $options = []){} |
|
112 | + static public function destroy($name, array $options = []) {} |
|
113 | 113 | |
114 | - static public function repair($name, array $options = []){} |
|
114 | + static public function repair($name, array $options = []) {} |
|
115 | 115 | } |
116 | 116 | |
117 | -class LevelDBIterator implements Iterator{ |
|
117 | +class LevelDBIterator implements Iterator { |
|
118 | 118 | |
119 | - public function __construct(LevelDB $db, array $read_options = []){} |
|
119 | + public function __construct(LevelDB $db, array $read_options = []) {} |
|
120 | 120 | |
121 | - public function valid(){} |
|
121 | + public function valid() {} |
|
122 | 122 | |
123 | - public function rewind(){} |
|
123 | + public function rewind() {} |
|
124 | 124 | |
125 | - public function last(){} |
|
125 | + public function last() {} |
|
126 | 126 | |
127 | - public function seek($key){} |
|
127 | + public function seek($key) {} |
|
128 | 128 | |
129 | - public function next(){} |
|
129 | + public function next() {} |
|
130 | 130 | |
131 | - public function prev(){} |
|
131 | + public function prev() {} |
|
132 | 132 | |
133 | - public function key(){} |
|
133 | + public function key() {} |
|
134 | 134 | |
135 | - public function current(){} |
|
135 | + public function current() {} |
|
136 | 136 | |
137 | - public function getError(){} |
|
137 | + public function getError() {} |
|
138 | 138 | |
139 | - public function destroy(){} |
|
139 | + public function destroy() {} |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | -class LevelDBWriteBatch{ |
|
144 | - public function __construct($name, array $options = [], array $read_options = [], array $write_options = []){} |
|
143 | +class LevelDBWriteBatch { |
|
144 | + public function __construct($name, array $options = [], array $read_options = [], array $write_options = []) {} |
|
145 | 145 | |
146 | - public function set($key, $value, array $write_options = []){} |
|
146 | + public function set($key, $value, array $write_options = []) {} |
|
147 | 147 | |
148 | - public function put($key, $value, array $write_options = []){} |
|
148 | + public function put($key, $value, array $write_options = []) {} |
|
149 | 149 | |
150 | - public function delete($key, array $write_options = []){} |
|
150 | + public function delete($key, array $write_options = []) {} |
|
151 | 151 | |
152 | - public function clear(){} |
|
152 | + public function clear() {} |
|
153 | 153 | } |
154 | 154 | |
155 | -class LevelDBSnapshot{ |
|
156 | - public function __construct(LevelDB $db){} |
|
155 | +class LevelDBSnapshot { |
|
156 | + public function __construct(LevelDB $db) {} |
|
157 | 157 | |
158 | - public function release(){} |
|
158 | + public function release() {} |
|
159 | 159 | |
160 | 160 | } |
161 | 161 | |
162 | -class LevelDBException extends Exception{ |
|
162 | +class LevelDBException extends Exception { |
|
163 | 163 | |
164 | 164 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | |
291 | 291 | /** |
292 | - * @return mixed |
|
292 | + * @return ExtendedCacheItemPoolInterface |
|
293 | 293 | */ |
294 | 294 | protected function backup() |
295 | 295 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
300 | - * @param $file |
|
300 | + * @param string $file |
|
301 | 301 | * @return string |
302 | 302 | * @throws \Exception |
303 | 303 | */ |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @param array $tags | array("a","b","c") |
480 | 480 | * @param int $time |
481 | 481 | * @param array $options |
482 | - * @return mixed |
|
482 | + * @return boolean |
|
483 | 483 | * @internal param array $option | $option = array("tags" => array("a","b","c") |
484 | 484 | */ |
485 | 485 | public function touchTags($tags = [], $time = 300, $options = []) |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | /** |
501 | 501 | * @param array $tags | array("a","b","c") |
502 | 502 | * @param array $option | $option = array("tags" => array("a","b","c") |
503 | - * @return mixed |
|
503 | + * @return boolean |
|
504 | 504 | */ |
505 | 505 | public function deleteTags($tags = [], $option = []) |
506 | 506 | { |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | * @param array $tags | array("a","b","c") |
523 | 523 | * @param integer |
524 | 524 | * @param array $option | $option = array("tags" => array("a","b","c") |
525 | - * @return mixed |
|
525 | + * @return boolean |
|
526 | 526 | */ |
527 | 527 | public function incrementTags($tags = [], $step = 1, $option = []) |
528 | 528 | { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * @param array $tags | array("a","b","c") |
544 | 544 | * @param integer |
545 | 545 | * @param array $option | $option = array("tags" => array("a","b","c") |
546 | - * @return mixed |
|
546 | + * @return boolean |
|
547 | 547 | */ |
548 | 548 | public function decrementTags($tags = [], $step = 1, $option = []) |
549 | 549 | { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | foreach ($list as $array) { |
232 | 232 | $name = $array[ 0 ]; |
233 | 233 | $res[ $name ] = $this->touch($name, $array[ 1 ], |
234 | - isset($array[ 2 ]) ? $array[ 2 ] : []); |
|
234 | + isset($array[ 2 ]) ? $array[ 2 ] : []); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $res; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | if (isset($v[ 1 ]) && is_scalar($v[ 1 ])) { |
278 | 278 | return $this->set($name, $v[ 0 ], $v[ 1 ], |
279 | - isset($v[ 2 ]) ? $v[ 2 ] : []); |
|
279 | + isset($v[ 2 ]) ? $v[ 2 ] : []); |
|
280 | 280 | } else { |
281 | 281 | throw new phpFastCacheDriverException("Example ->$name = array('VALUE', 300);"); |
282 | 282 | } |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | protected function _tagCaching() |
396 | 396 | { |
397 | 397 | return CacheManager::Sqlite( |
398 | - [ |
|
398 | + [ |
|
399 | 399 | "path" => $this->config[ 'path' ], |
400 | 400 | "cache_method" => 3, |
401 | - ] |
|
401 | + ] |
|
402 | 402 | ); |
403 | 403 | } |
404 | 404 | |
@@ -567,9 +567,9 @@ discard block |
||
567 | 567 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
568 | 568 | { |
569 | 569 | return [ |
570 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
571 | - self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(), |
|
572 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
570 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
571 | + self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(), |
|
572 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
573 | 573 | ]; |
574 | 574 | } |
575 | 575 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function __destruct() |
63 | 63 | { |
64 | 64 | // clean up the memory and don't want for PHP clean for caching method "phpfastcache" |
65 | - if (isset($this->config[ 'instance' ]) && (int) $this->config[ 'cache_method' ] === 3) { |
|
66 | - CacheManager::cleanCachingMethod($this->config[ 'instance' ]); |
|
65 | + if (isset($this->config['instance']) && (int) $this->config['cache_method'] === 3) { |
|
66 | + CacheManager::cleanCachingMethod($this->config['instance']); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function getInfo($keyword, $option = []) |
87 | 87 | { |
88 | - if ((int) $this->config[ 'cache_method' ] > 1) { |
|
89 | - if (isset(CacheManager::$memory[ $this->config[ 'instance' ] ][ $keyword ])) { |
|
90 | - $object = CacheManager::$memory[ $this->config[ 'instance' ] ][ $keyword ]; |
|
88 | + if ((int) $this->config['cache_method'] > 1) { |
|
89 | + if (isset(CacheManager::$memory[$this->config['instance']][$keyword])) { |
|
90 | + $object = CacheManager::$memory[$this->config['instance']][$keyword]; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | if (!isset($object)) { |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | public function clean(array $option = []) |
117 | 117 | { |
118 | 118 | // handle method |
119 | - if ((int) $this->config[ 'cache_method' ] > 1) { |
|
119 | + if ((int) $this->config['cache_method'] > 1) { |
|
120 | 120 | // use memory |
121 | - CacheManager::$memory[ $this->config[ 'instance' ] ] = []; |
|
121 | + CacheManager::$memory[$this->config['instance']] = []; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // end handle method |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function search($query_as_regex_or_string, $search_in_value = false) |
155 | 155 | { |
156 | - if ($this->config[ 'allow_search' ] != true) { |
|
156 | + if ($this->config['allow_search'] != true) { |
|
157 | 157 | throw new phpFastCacheDriverException('Please setup allow_search = true'); |
158 | 158 | } else { |
159 | 159 | $list = $this->getTags("search", $search_in_value); |
160 | 160 | $tmp = explode("/", $query_as_regex_or_string, 2); |
161 | - $regex = isset($tmp[ 1 ]) ? true : false; |
|
161 | + $regex = isset($tmp[1]) ? true : false; |
|
162 | 162 | $return_list = []; |
163 | 163 | foreach ($list as $tag) { |
164 | 164 | foreach ($tag as $keyword => $value) { |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | |
170 | 170 | if ($regex == true && $gotcha == false) { // look in keyword |
171 | 171 | if (preg_match($query_as_regex_or_string, $keyword)) { |
172 | - $return_list[ $keyword ] = $value; |
|
172 | + $return_list[$keyword] = $value; |
|
173 | 173 | $gotcha = true; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | if ($gotcha == false) { |
177 | 177 | if (strpos($keyword, $query_as_regex_or_string) !== false) { |
178 | - $return_list[ $keyword ] = $value; |
|
178 | + $return_list[$keyword] = $value; |
|
179 | 179 | $gotcha = true; |
180 | 180 | } |
181 | 181 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | if ($search_in_value == true && $gotcha == false) { // value search |
184 | 184 | if ($regex == true && $gotcha == false) { |
185 | 185 | if (preg_match($query_as_regex_or_string, $value)) { |
186 | - $return_list[ $keyword ] = $value; |
|
186 | + $return_list[$keyword] = $value; |
|
187 | 187 | $gotcha = true; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | if ($gotcha == false) { |
191 | 191 | if (strpos($value, $query_as_regex_or_string) !== false) { |
192 | - $return_list[ $keyword ] = $value; |
|
192 | + $return_list[$keyword] = $value; |
|
193 | 193 | $gotcha = true; |
194 | 194 | } |
195 | 195 | } |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | if ($object == null) { |
214 | 214 | return false; |
215 | 215 | } else { |
216 | - $value = $object[ 'value' ]; |
|
217 | - $time = $object[ 'expired_time' ] - time() + $time; |
|
216 | + $value = $object['value']; |
|
217 | + $time = $object['expired_time'] - time() + $time; |
|
218 | 218 | $this->set($keyword, $value, $time, $option); |
219 | 219 | |
220 | 220 | return true; |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | { |
230 | 230 | $res = []; |
231 | 231 | foreach ($list as $array) { |
232 | - $name = $array[ 0 ]; |
|
233 | - $res[ $name ] = $this->touch($name, $array[ 1 ], |
|
234 | - isset($array[ 2 ]) ? $array[ 2 ] : []); |
|
232 | + $name = $array[0]; |
|
233 | + $res[$name] = $this->touch($name, $array[1], |
|
234 | + isset($array[2]) ? $array[2] : []); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $res; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | if (is_array($config_name)) { |
250 | 250 | $this->config = array_merge($this->config, $config_name); |
251 | 251 | } else { |
252 | - $this->config[ $config_name ] = $value; |
|
252 | + $this->config[$config_name] = $value; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function __set($name, $v) |
276 | 276 | { |
277 | - if (isset($v[ 1 ]) && is_scalar($v[ 1 ])) { |
|
278 | - return $this->set($name, $v[ 0 ], $v[ 1 ], |
|
279 | - isset($v[ 2 ]) ? $v[ 2 ] : []); |
|
277 | + if (isset($v[1]) && is_scalar($v[1])) { |
|
278 | + return $this->set($name, $v[0], $v[1], |
|
279 | + isset($v[2]) ? $v[2] : []); |
|
280 | 280 | } else { |
281 | 281 | throw new phpFastCacheDriverException("Example ->$name = array('VALUE', 300);"); |
282 | 282 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | protected function backup() |
295 | 295 | { |
296 | - return CacheManager::getInstance(CacheManager::$config[ 'fallback' ]); |
|
296 | + return CacheManager::getInstance(CacheManager::$config['fallback']); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | { |
397 | 397 | return CacheManager::Sqlite( |
398 | 398 | [ |
399 | - "path" => $this->config[ 'path' ], |
|
399 | + "path" => $this->config['path'], |
|
400 | 400 | "cache_method" => 3, |
401 | 401 | ] |
402 | 402 | ); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if (!is_array($tags)) { |
416 | 416 | $tags = [$tags]; |
417 | 417 | } |
418 | - $option[ 'tags' ] = $tags; |
|
418 | + $option['tags'] = $tags; |
|
419 | 419 | |
420 | 420 | return $this->set($keyword, $value, $time, $option); |
421 | 421 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | if (is_null($list)) { |
428 | 428 | $list = []; |
429 | 429 | } |
430 | - $list[ $keyword ] = time() + $time; |
|
430 | + $list[$keyword] = time() + $time; |
|
431 | 431 | $this->_tagCaching()->set($this->_getTagName($tag), $list, 3600 * 24 * 30); |
432 | 432 | } |
433 | 433 | } |
@@ -455,21 +455,21 @@ discard block |
||
455 | 455 | } |
456 | 456 | foreach ($list as $keyword => $time) { |
457 | 457 | if ($time <= time()) { |
458 | - unset($list[ $keyword ]); |
|
458 | + unset($list[$keyword]); |
|
459 | 459 | } else { |
460 | 460 | if ($tmp < $time) { |
461 | 461 | $tmp = $time; |
462 | 462 | } |
463 | 463 | if ($return_content == true) { |
464 | - $list_return[ $keyword ] = $this->get($keyword); |
|
464 | + $list_return[$keyword] = $this->get($keyword); |
|
465 | 465 | } else { |
466 | - $list_return[ $keyword ] = $time; |
|
466 | + $list_return[$keyword] = $time; |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | } |
470 | 470 | |
471 | 471 | $this->_tagCaching()->set($this->_getTagName($tag), $list, $tmp); |
472 | - $keywords[ $tag ] = $list_return; |
|
472 | + $keywords[$tag] = $list_return; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $keywords; |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function driverUnwrapData(array $wrapper) |
581 | 581 | { |
582 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
582 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | */ |
589 | 589 | public function driverUnwrapTags(array $wrapper) |
590 | 590 | { |
591 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
591 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | public function driverUnwrapTime(array $wrapper) |
600 | 600 | { |
601 | - return $wrapper[ self::DRIVER_TIME_WRAPPER_INDEX ]; |
|
601 | + return $wrapper[self::DRIVER_TIME_WRAPPER_INDEX]; |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | /** |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | foreach ($tagsItems as $tagsItem) { |
653 | 653 | $data = (array) $tagsItem->get(); |
654 | 654 | |
655 | - unset($data[ $item->getKey() ]); |
|
655 | + unset($data[$item->getKey()]); |
|
656 | 656 | $tagsItem->set($data); |
657 | 657 | |
658 | 658 | /** |
@@ -20,7 +20,6 @@ discard block |
||
20 | 20 | trait PathSeekerTrait |
21 | 21 | { |
22 | 22 | /** |
23 | - * @param bool $skip_create_path |
|
24 | 23 | * @param $config |
25 | 24 | * @return string |
26 | 25 | * @throws \Exception |
@@ -155,7 +154,7 @@ discard block |
||
155 | 154 | |
156 | 155 | /** |
157 | 156 | * @param $filename |
158 | - * @return mixed |
|
157 | + * @return string |
|
159 | 158 | */ |
160 | 159 | protected static function cleanFileName($filename) |
161 | 160 | { |
@@ -170,7 +169,7 @@ discard block |
||
170 | 169 | } |
171 | 170 | |
172 | 171 | /** |
173 | - * @param $path |
|
172 | + * @param string $path |
|
174 | 173 | * @param bool $create |
175 | 174 | * @throws \Exception |
176 | 175 | */ |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | protected static function cleanFileName($filename) |
161 | 161 | { |
162 | 162 | $regex = [ |
163 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
164 | - '/\.$/', |
|
165 | - '/^\./', |
|
163 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
164 | + '/\.$/', |
|
165 | + '/^\./', |
|
166 | 166 | ]; |
167 | 167 | $replace = ['-', '', '']; |
168 | 168 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | chmod($path, 0777); |
183 | 183 | } catch (phpFastCacheDriverException $e) { |
184 | 184 | throw new phpFastCacheDriverException('PLEASE CHMOD ' . $path . ' - 0777 OR ANY WRITABLE PERMISSION!', |
185 | - 92); |
|
185 | + 92); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -29,27 +29,27 @@ discard block |
||
29 | 29 | { |
30 | 30 | $tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(); |
31 | 31 | |
32 | - if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') { |
|
32 | + if (!isset($this->config['path']) || $this->config['path'] == '') { |
|
33 | 33 | if (self::isPHPModule()) { |
34 | 34 | $path = $tmp_dir; |
35 | 35 | } else { |
36 | - $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../'; |
|
37 | - $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/'; |
|
36 | + $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../'; |
|
37 | + $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . '/'; |
|
38 | 38 | } |
39 | 39 | |
40 | - if ($this->config[ 'path' ] != '') { |
|
41 | - $path = $this->config[ 'path' ]; |
|
40 | + if ($this->config['path'] != '') { |
|
41 | + $path = $this->config['path']; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | } else { |
45 | - $path = $this->config[ 'path' ]; |
|
45 | + $path = $this->config['path']; |
|
46 | 46 | } |
47 | 47 | |
48 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
48 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
49 | 49 | if ($securityKey == "" || $securityKey == 'auto') { |
50 | - $securityKey = $this->config[ 'securityKey' ]; |
|
50 | + $securityKey = $this->config['securityKey']; |
|
51 | 51 | if ($securityKey == 'auto' || $securityKey == '') { |
52 | - $securityKey = isset($_SERVER[ 'HTTP_HOST' ]) ? preg_replace('/^www./', '', strtolower($_SERVER[ 'HTTP_HOST' ])) : "default"; |
|
52 | + $securityKey = isset($_SERVER['HTTP_HOST']) ? preg_replace('/^www./', '', strtolower($_SERVER['HTTP_HOST'])) : "default"; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | if ($securityKey != '') { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $full_pathx = md5($full_path); |
63 | 63 | |
64 | 64 | |
65 | - if (!isset($this->tmp[ $full_pathx ])) { |
|
65 | + if (!isset($this->tmp[$full_pathx])) { |
|
66 | 66 | |
67 | 67 | if (!@file_exists($full_path) || !@is_writable($full_path)) { |
68 | 68 | if (!@file_exists($full_path)) { |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - $this->tmp[ $full_pathx ] = true; |
|
90 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
89 | + $this->tmp[$full_pathx] = true; |
|
90 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return realpath($full_path); |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setChmodAuto() |
148 | 148 | { |
149 | - if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) { |
|
149 | + if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) { |
|
150 | 150 | return 0777; |
151 | 151 | } else { |
152 | - return $this->config[ 'default_chmod' ]; |
|
152 | + return $this->config['default_chmod']; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @param \Psr\Cache\CacheItemInterface $item |
160 | - * @return mixed |
|
160 | + * @return boolean |
|
161 | 161 | * @throws \InvalidArgumentException |
162 | 162 | */ |
163 | 163 | public function save(CacheItemInterface $item) |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * @return mixed|null |
|
178 | + * @return boolean |
|
179 | 179 | * @throws \InvalidArgumentException |
180 | 180 | */ |
181 | 181 | public function commit() |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key))); |
72 | 72 | } |
73 | 73 | |
74 | - return $this->itemInstances[ $key ]; |
|
74 | + return $this->itemInstances[$key]; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function setItem(CacheItemInterface $item) |
83 | 83 | { |
84 | 84 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
85 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
85 | + $this->itemInstances[$item->getKey()] = $item; |
|
86 | 86 | |
87 | 87 | return $this; |
88 | 88 | } else { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $collection = []; |
101 | 101 | foreach ($keys as $key) { |
102 | - $collection[ $key ] = $this->getItem($key); |
|
102 | + $collection[$key] = $this->getItem($key); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $collection; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function saveDeferred(CacheItemInterface $item) |
173 | 173 | { |
174 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
174 | + return $this->deferredList[$item->getKey()] = $item; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | foreach ($this->deferredList as $key => $item) { |
185 | 185 | $result = $this->save($item); |
186 | 186 | if ($return !== false) { |
187 | - unset($this->deferredList[ $key ]); |
|
187 | + unset($this->deferredList[$key]); |
|
188 | 188 | $return = $result; |
189 | 189 | } |
190 | 190 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * @return bool |
|
131 | + * @return boolean|null |
|
132 | 132 | */ |
133 | 133 | public function driverConnect() |
134 | 134 | { |
@@ -142,10 +142,10 @@ |
||
142 | 142 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
143 | 143 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
144 | 144 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
145 | - [ |
|
145 | + [ |
|
146 | 146 | 'bucket' => 'default', |
147 | 147 | 'password' => '', |
148 | - ], |
|
148 | + ], |
|
149 | 149 | ]; |
150 | 150 | |
151 | 151 | $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password); |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } else { |
138 | 138 | |
139 | 139 | |
140 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
140 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
141 | 141 | //$port = isset($server[ 'port' ]) ? $server[ 'port' ] : '11211'; |
142 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
143 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
144 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
142 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
143 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
144 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
145 | 145 | [ |
146 | 146 | 'bucket' => 'default', |
147 | 147 | 'password' => '', |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | foreach ($buckets as $bucket) { |
155 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
156 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
155 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
156 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getBucket() |
165 | 165 | { |
166 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
166 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
175 | 175 | { |
176 | 176 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
177 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
177 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
178 | 178 | } else { |
179 | 179 | throw new \LogicException('A bucket instance with this name already exists.'); |
180 | 180 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @param \Psr\Cache\CacheItemInterface $item |
56 | - * @return mixed |
|
56 | + * @return boolean |
|
57 | 57 | * @throws \InvalidArgumentException |
58 | 58 | */ |
59 | 59 | public function driverWrite(CacheItemInterface $item) |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | /** |
114 | 114 | * @param \Psr\Cache\CacheItemInterface $item |
115 | - * @return bool |
|
115 | + * @return boolean|null |
|
116 | 116 | * @throws \InvalidArgumentException |
117 | 117 | */ |
118 | 118 | public function driverIsHit(CacheItemInterface $item) |
@@ -140,8 +140,8 @@ |
||
140 | 140 | { |
141 | 141 | $stat = new driverStatistic(); |
142 | 142 | $stat->setInfo('A void info string') |
143 | - ->setSize(1337) |
|
144 | - ->setData('A void data string'); |
|
143 | + ->setSize(1337) |
|
144 | + ->setData('A void data string'); |
|
145 | 145 | |
146 | 146 | return $stat; |
147 | 147 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @param \Psr\Cache\CacheItemInterface $item |
56 | - * @return mixed |
|
56 | + * @return boolean |
|
57 | 57 | * @throws \InvalidArgumentException |
58 | 58 | */ |
59 | 59 | public function driverWrite(CacheItemInterface $item) |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @param $key |
73 | - * @return mixed |
|
73 | + * @return boolean |
|
74 | 74 | */ |
75 | 75 | public function driverRead($key) |
76 | 76 | { |
@@ -140,8 +140,8 @@ |
||
140 | 140 | { |
141 | 141 | $stat = new driverStatistic(); |
142 | 142 | $stat->setInfo('A void info string') |
143 | - ->setSize(1337) |
|
144 | - ->setData('A void data string'); |
|
143 | + ->setSize(1337) |
|
144 | + ->setData('A void data string'); |
|
145 | 145 | |
146 | 146 | return $stat; |
147 | 147 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param \Psr\Cache\CacheItemInterface $item |
58 | - * @return mixed |
|
58 | + * @return boolean|null |
|
59 | 59 | * @throws \InvalidArgumentException |
60 | 60 | */ |
61 | 61 | public function driverWrite(CacheItemInterface $item) |
@@ -14,7 +14,6 @@ |
||
14 | 14 | |
15 | 15 | namespace phpFastCache\Drivers\Files; |
16 | 16 | |
17 | -use phpFastCache\Cache\ExtendedCacheItemInterface; |
|
18 | 17 | use phpFastCache\Core\DriverAbstract; |
19 | 18 | use phpFastCache\Core\PathSeekerTrait; |
20 | 19 | use phpFastCache\Core\StandardPsr6StructureTrait; |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | $key = $key[ 0 ]; |
254 | 254 | } |
255 | 255 | $content[ $key ] = [ |
256 | - 'size' => $size, |
|
257 | - 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
256 | + 'size' => $size, |
|
257 | + 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
258 | 258 | ]; |
259 | 259 | if ($object->isExpired()) { |
260 | 260 | @unlink($file_path); |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | $stat->setData($content) |
270 | - ->setSize($total - $removed) |
|
271 | - ->setInfo('Total [bytes]: ' . $total . ', ' |
|
270 | + ->setSize($total - $removed) |
|
271 | + ->setInfo('Total [bytes]: ' . $total . ', ' |
|
272 | 272 | . 'Expired and removed [bytes]: ' . $removed . ', ' |
273 | 273 | . 'Current [bytes], ' . $total - $removed |
274 | - ); |
|
274 | + ); |
|
275 | 275 | |
276 | 276 | return $stat; |
277 | 277 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /* |
72 | 72 | * Skip if Existing Caching in Options |
73 | 73 | */ |
74 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) { |
|
74 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) { |
|
75 | 75 | $content = $this->readfile($file_path); |
76 | 76 | $old = $this->decode($content); |
77 | 77 | $toWrite = false; |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | } else { |
251 | 251 | //Because PHP 5.3, this cannot be written in single line |
252 | 252 | $key = explode('.', $f); |
253 | - $key = $key[ 0 ]; |
|
253 | + $key = $key[0]; |
|
254 | 254 | } |
255 | - $content[ $key ] = [ |
|
255 | + $content[$key] = [ |
|
256 | 256 | 'size' => $size, |
257 | - 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
257 | + 'write_time' => (isset($object['write_time']) ? $object['write_time'] : null), |
|
258 | 258 | ]; |
259 | 259 | if ($object->isExpired()) { |
260 | 260 | @unlink($file_path); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | /** |
106 | 106 | * @param \Psr\Cache\CacheItemInterface $item |
107 | - * @return bool |
|
107 | + * @return boolean|null |
|
108 | 108 | * @throws \InvalidArgumentException |
109 | 109 | */ |
110 | 110 | public function driverDelete(CacheItemInterface $item) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * @return bool |
|
123 | + * @return boolean|null |
|
124 | 124 | */ |
125 | 125 | public function driverClear() |
126 | 126 | { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | - * @return bool |
|
138 | + * @return boolean|null |
|
139 | 139 | */ |
140 | 140 | public function driverConnect() |
141 | 141 | { |
@@ -124,7 +124,7 @@ |
||
124 | 124 | */ |
125 | 125 | public function driverClear() |
126 | 126 | { |
127 | - if($this->instance instanceof LeveldbClient) |
|
127 | + if ($this->instance instanceof LeveldbClient) |
|
128 | 128 | { |
129 | 129 | $this->instance->close(); |
130 | 130 | unset($this->instance); |