@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | protected function driverConnect() |
139 | 139 | { |
140 | 140 | try { |
141 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
|
141 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [ |
|
142 | 142 | 'host' => "127.0.0.1", |
143 | 143 | 'port' => 8888, |
144 | 144 | 'password' => '', |
145 | 145 | 'timeout' => 2000, |
146 | 146 | ]; |
147 | 147 | |
148 | - $host = $server[ 'host' ]; |
|
149 | - $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888; |
|
150 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
151 | - $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000; |
|
148 | + $host = $server['host']; |
|
149 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
150 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
151 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
152 | 152 | $this->instance = new SimpleSSDB($host, $port, $timeout); |
153 | 153 | if (!empty($password)) { |
154 | 154 | $this->instance->auth($password); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Data returned by Ssdb are very poorly formatted |
183 | 183 | * using hardcoded offset of pair key-value :-( |
184 | 184 | */ |
185 | - $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
185 | + $stat->setInfo(sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
186 | 186 | ->setRawData($info) |
187 | 187 | ->setData(implode(', ', array_keys($this->itemInstances))) |
188 | 188 | ->setSize($this->instance->dbsize()); |
@@ -74,9 +74,9 @@ |
||
74 | 74 | */ |
75 | 75 | public function __call($name, $args) |
76 | 76 | { |
77 | - if(method_exists($this->instance, $name)){ |
|
77 | + if (method_exists($this->instance, $name)) { |
|
78 | 78 | return call_user_func_array([$this->instance, $name], $args); |
79 | - }else{ |
|
79 | + } else { |
|
80 | 80 | throw new \BadMethodCallException(sprintf('Method %s does not exists', $name)); |
81 | 81 | } |
82 | 82 | } |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
163 | 163 | $stm->execute(); |
164 | 164 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
165 | - if (!isset($row[ 'db' ])) { |
|
165 | + if (!isset($row['db'])) { |
|
166 | 166 | $db = 1; |
167 | - } elseif ($row[ 'db' ] <= 1) { |
|
167 | + } elseif ($row['db'] <= 1) { |
|
168 | 168 | $db = 1; |
169 | 169 | } else { |
170 | - $db = $row[ 'db' ]; |
|
170 | + $db = $row['db']; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // check file size |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | ':keyword' => $keyword, |
190 | 190 | ]); |
191 | 191 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
192 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
193 | - $db = $row[ 'db' ]; |
|
192 | + if (isset($row['db']) && $row['db'] != '') { |
|
193 | + $db = $row['db']; |
|
194 | 194 | } else { |
195 | 195 | /* |
196 | 196 | * Insert new to Indexing |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | /** |
222 | 222 | * init instant |
223 | 223 | */ |
224 | - if (!isset($this->instance[ $instant ])) { |
|
224 | + if (!isset($this->instance[$instant])) { |
|
225 | 225 | // check DB Files ready or not |
226 | 226 | $createTable = false; |
227 | 227 | if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | $this->initDB($PDO); |
235 | 235 | } |
236 | 236 | |
237 | - $this->instance[ $instant ] = $PDO; |
|
237 | + $this->instance[$instant] = $PDO; |
|
238 | 238 | unset($PDO); |
239 | 239 | |
240 | 240 | } |
241 | 241 | |
242 | - return $this->instance[ $instant ]; |
|
242 | + return $this->instance[$instant]; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * Check for Cross-Driver type confusion |
254 | 254 | */ |
255 | 255 | if ($item instanceof Item) { |
256 | - $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false; |
|
256 | + $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false; |
|
257 | 257 | $toWrite = true; |
258 | 258 | |
259 | 259 | // check in cache first |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | - if (isset($row[ 'object' ])) { |
|
333 | - return $this->decode($row[ 'object' ]); |
|
332 | + if (isset($row['object'])) { |
|
333 | + return $this->decode($row['object']); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return null; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->instances =& CacheManager::getInternalInstances(); |
|
24 | + $this->instances = & CacheManager::getInternalInstances(); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function getGenericCallback() |
31 | 31 | { |
32 | - return function($method, $args){ |
|
32 | + return function($method, $args) { |
|
33 | 33 | $getterMethod = (strpos($method, 'get') === 0); |
34 | 34 | $return = false; |
35 | 35 | |
36 | - if($getterMethod){ |
|
36 | + if ($getterMethod) { |
|
37 | 37 | $return = []; |
38 | 38 | } |
39 | 39 | |
40 | 40 | foreach ($this->instances as $instance) |
41 | 41 | { |
42 | 42 | $reflectionMethod = new \ReflectionMethod(get_class($instance), $method); |
43 | - if($getterMethod){ |
|
44 | - $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args); |
|
45 | - }else{ |
|
43 | + if ($getterMethod) { |
|
44 | + $return[$instance->getDriverName()] = $reflectionMethod->invokeArgs($instance, $args); |
|
45 | + } else { |
|
46 | 46 | $result = $reflectionMethod->invokeArgs($instance, $args); |
47 | - if($result !== false){ |
|
47 | + if ($result !== false) { |
|
48 | 48 | $return = $result; |
49 | 49 | } |
50 | 50 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | protected function driverRead(CacheItemInterface $item) |
85 | 85 | { |
86 | 86 | $key = md5($item->getKey()); |
87 | - if(isset($this->staticStack[$key])){ |
|
87 | + if (isset($this->staticStack[$key])) { |
|
88 | 88 | return $this->staticStack[$key]; |
89 | 89 | } |
90 | 90 | return null; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | if ($item instanceof Item) { |
104 | 104 | $key = md5($item->getKey()); |
105 | - if(isset($this->staticStack[$key])){ |
|
105 | + if (isset($this->staticStack[$key])) { |
|
106 | 106 | unset($this->staticStack[$key]); |
107 | 107 | return true; |
108 | 108 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $keyword = self::PREFIX . $item->getKey(); |
81 | 81 | $v = json_encode($this->driverPreWrap($item)); |
82 | 82 | |
83 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
83 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // return null if no caching |
102 | 102 | // return value if in caching |
103 | 103 | $keyword = self::PREFIX . $item->getKey(); |
104 | - $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false; |
|
104 | + $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false; |
|
105 | 105 | |
106 | 106 | if ($x == false) { |
107 | 107 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->driverConnect(); |
124 | 124 | $keyword = self::PREFIX . $key; |
125 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
125 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
126 | 126 | |
127 | 127 | return $x ? $x - time() : $x; |
128 | 128 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if ($item instanceof Item) { |
141 | 141 | $this->driverConnect(); |
142 | 142 | $keyword = self::PREFIX . $item->getKey(); |
143 | - $_COOKIE[ $keyword ] = null; |
|
143 | + $_COOKIE[$keyword] = null; |
|
144 | 144 | |
145 | 145 | return @setcookie($keyword, null, -10); |
146 | 146 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $this->driverConnect(); |
158 | 158 | foreach ($_COOKIE as $keyword => $value) { |
159 | 159 | if (strpos($keyword, self::PREFIX) !== false) { |
160 | - $_COOKIE[ $keyword ] = null; |
|
160 | + $_COOKIE[$keyword] = null; |
|
161 | 161 | $result = @setcookie($keyword, null, -10); |
162 | 162 | if ($return !== false) { |
163 | 163 | $return = $result; |
@@ -85,8 +85,7 @@ discard block |
||
85 | 85 | return unlink($source); |
86 | 86 | } |
87 | 87 | |
88 | - $files = new RecursiveIteratorIterator |
|
89 | - ( |
|
88 | + $files = new RecursiveIteratorIterator( |
|
90 | 89 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
91 | 90 | RecursiveIteratorIterator::CHILD_FIRST |
92 | 91 | ); |
@@ -136,7 +135,7 @@ discard block |
||
136 | 135 | /** |
137 | 136 | * Allows to dereference char |
138 | 137 | */ |
139 | - $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
138 | + $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
140 | 139 | $prefix = $__FILE__[0] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : ''; |
141 | 140 | return $prefix . implode(DIRECTORY_SEPARATOR, $absolutes); |
142 | 141 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | public function getMultiple($keys, $default = null) |
111 | 111 | { |
112 | 112 | try { |
113 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
113 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
114 | 114 | return $item->get(); |
115 | 115 | }, $this->internalCacheInstance->getItems($keys)); |
116 | 116 | } catch (phpFastCacheInvalidArgumentException $e) { |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Register Autoload |
20 | 20 | */ |
21 | -spl_autoload_register(function ($entity) { |
|
21 | +spl_autoload_register(function($entity) { |
|
22 | 22 | $module = explode('\\', $entity, 2); |
23 | - if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) { |
|
23 | + if (!in_array($module[0], ['phpFastCache', 'Psr'])) { |
|
24 | 24 | /** |
25 | 25 | * Not a part of phpFastCache file |
26 | 26 | * then we return here. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | if (is_readable($path)) { |
33 | 33 | require_once $path; |
34 | - }else{ |
|
34 | + } else { |
|
35 | 35 | trigger_error('Cannot locate the Psr/Cache files', E_USER_ERROR); |
36 | 36 | } |
37 | 37 | return; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | if (is_readable($path)) { |
42 | 42 | require_once $path; |
43 | - }else{ |
|
43 | + } else { |
|
44 | 44 | trigger_error('Cannot locate the Psr/SimpleCache files', E_USER_ERROR); |
45 | 45 | } |
46 | 46 | return; |