@@ -27,7 +27,7 @@ |
||
| 27 | 27 | return true; |
| 28 | 28 | } else if (constant($CONSTANT_NAME) !== $driverName) { |
| 29 | 29 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
| 30 | - E_USER_WARNING); |
|
| 30 | + E_USER_WARNING); |
|
| 31 | 31 | |
| 32 | 32 | return false; |
| 33 | 33 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | public function removeTag($tagName) |
| 350 | 350 | { |
| 351 | 351 | if (($key = array_search($tagName, $this->tags)) !== false) { |
| 352 | - unset($this->tags[ $key ]); |
|
| 352 | + unset($this->tags[$key]); |
|
| 353 | 353 | $this->removedTags[] = $tagName; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | final public function __debugInfo() |
| 393 | 393 | { |
| 394 | 394 | $info = get_object_vars($this); |
| 395 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
| 395 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
| 396 | 396 | |
| 397 | 397 | return (array) $info; |
| 398 | 398 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $this->driver->setItem($this); |
| 43 | 43 | } else { |
| 44 | 44 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', |
| 45 | - gettype($key))); |
|
| 45 | + gettype($key))); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -214,9 +214,9 @@ |
||
| 214 | 214 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
| 215 | 215 | { |
| 216 | 216 | return [ |
| 217 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 218 | - self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 219 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 217 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 218 | + self::DRIVER_TIME_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 219 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 220 | 220 | ]; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if (is_array($config_name)) { |
| 61 | 61 | $this->config = array_merge($this->config, $config_name); |
| 62 | 62 | } else { |
| 63 | - $this->config[ $config_name ] = $value; |
|
| 63 | + $this->config[$config_name] = $value; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function driverUnwrapData(array $wrapper) |
| 181 | 181 | { |
| 182 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
| 182 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function driverUnwrapTags(array $wrapper) |
| 190 | 190 | { |
| 191 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
| 191 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function driverUnwrapTime(array $wrapper) |
| 200 | 200 | { |
| 201 | - return $wrapper[ self::DRIVER_TIME_WRAPPER_INDEX ]; |
|
| 201 | + return $wrapper[self::DRIVER_TIME_WRAPPER_INDEX]; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * on tags item, it can leads |
| 224 | 224 | * to an infinite recursive calls |
| 225 | 225 | */ |
| 226 | - if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){ |
|
| 226 | + if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) { |
|
| 227 | 227 | throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | foreach ($tagsItems as $tagsItem) { |
| 267 | 267 | $data = (array) $tagsItem->get(); |
| 268 | 268 | |
| 269 | - unset($data[ $item->getKey() ]); |
|
| 269 | + unset($data[$item->getKey()]); |
|
| 270 | 270 | $tagsItem->set($data); |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * @param $file |
|
| 67 | + * @param string $file |
|
| 68 | 68 | * @return string |
| 69 | 69 | * @throws \Exception |
| 70 | 70 | */ |
@@ -176,9 +176,9 @@ |
||
| 176 | 176 | public function getStats() |
| 177 | 177 | { |
| 178 | 178 | return (new driverStatistic()) |
| 179 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 180 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile())) |
|
| 181 | - ->setSize(Directory::dirSize($this->getLeveldbFile())); |
|
| 179 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 180 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile())) |
|
| 181 | + ->setSize(Directory::dirSize($this->getLeveldbFile())); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -17,7 +17,6 @@ |
||
| 17 | 17 | use LevelDB as LeveldbClient; |
| 18 | 18 | use phpFastCache\Core\DriverAbstract; |
| 19 | 19 | use phpFastCache\Core\PathSeekerTrait; |
| 20 | -use phpFastCache\Core\StandardPsr6StructureTrait; |
|
| 21 | 20 | use phpFastCache\Entities\driverStatistic; |
| 22 | 21 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 23 | 22 | use phpFastCache\Exceptions\phpFastCacheDriverException; |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * @return bool |
|
| 129 | + * @return boolean|null |
|
| 130 | 130 | */ |
| 131 | 131 | protected function driverConnect() |
| 132 | 132 | { |
@@ -254,9 +254,9 @@ |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | $stat->setData(implode(', ', array_keys($this->itemInstances))) |
| 257 | - ->setRawData([]) |
|
| 258 | - ->setSize(Directory::dirSize($path)) |
|
| 259 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 257 | + ->setRawData([]) |
|
| 258 | + ->setSize(Directory::dirSize($path)) |
|
| 259 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 260 | 260 | |
| 261 | 261 | return $stat; |
| 262 | 262 | } |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | use phpFastCache\Core\DriverAbstract; |
| 18 | 18 | use phpFastCache\Core\PathSeekerTrait; |
| 19 | -use phpFastCache\Core\StandardPsr6StructureTrait; |
|
| 20 | 19 | use phpFastCache\Entities\driverStatistic; |
| 21 | 20 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 22 | 21 | use phpFastCache\Exceptions\phpFastCacheDriverException; |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | /** |
| 78 | 78 | * Skip if Existing Caching in Options |
| 79 | 79 | */ |
| 80 | - if (isset($this->config[ 'skipExisting' ]) && $this->config[ 'skipExisting' ] == true && file_exists($file_path)) { |
|
| 80 | + if (isset($this->config['skipExisting']) && $this->config['skipExisting'] == true && file_exists($file_path)) { |
|
| 81 | 81 | $content = $this->readfile($file_path); |
| 82 | 82 | $old = $this->decode($content); |
| 83 | 83 | $toWrite = false; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param \Psr\Cache\CacheItemInterface $item |
| 63 | - * @return mixed |
|
| 63 | + * @return boolean|null |
|
| 64 | 64 | * @throws \InvalidArgumentException |
| 65 | 65 | */ |
| 66 | 66 | protected function driverWrite(CacheItemInterface $item) |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | /** |
| 167 | 167 | * @param string $optionName |
| 168 | 168 | * @param mixed $optionValue |
| 169 | - * @return bool |
|
| 169 | + * @return boolean|null |
|
| 170 | 170 | * @throws \InvalidArgumentException |
| 171 | 171 | */ |
| 172 | 172 | public static function isValidOption($optionName, $optionValue) |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | - * @return array |
|
| 197 | + * @return string[] |
|
| 198 | 198 | */ |
| 199 | 199 | public static function getValidOptions() |
| 200 | 200 | { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | - * @return array |
|
| 205 | + * @return string[] |
|
| 206 | 206 | */ |
| 207 | 207 | public static function getRequiredOptions() |
| 208 | 208 | { |
@@ -83,8 +83,8 @@ |
||
| 83 | 83 | |
| 84 | 84 | $files = new RecursiveIteratorIterator |
| 85 | 85 | ( |
| 86 | - new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | - RecursiveIteratorIterator::CHILD_FIRST |
|
| 86 | + new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | + RecursiveIteratorIterator::CHILD_FIRST |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | foreach ($files as $fileinfo) { |
@@ -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 | ); |
@@ -99,7 +98,7 @@ discard block |
||
| 99 | 98 | if (self::rrmdir($fileinfo->getRealPath()) === false) { |
| 100 | 99 | return false; |
| 101 | 100 | } |
| 102 | - } else if(unlink($fileinfo->getRealPath()) === false) { |
|
| 101 | + } else if (unlink($fileinfo->getRealPath()) === false) { |
|
| 103 | 102 | return false; |
| 104 | 103 | } |
| 105 | 104 | } |
@@ -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 | } |
@@ -159,9 +159,9 @@ |
||
| 159 | 159 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
| 160 | 160 | |
| 161 | 161 | return (new driverStatistic()) |
| 162 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 163 | - ->setRawData($info) |
|
| 164 | - ->setSize($info[ 'used_memory' ]) |
|
| 165 | - ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 162 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 163 | + ->setRawData($info) |
|
| 164 | + ->setSize($info[ 'used_memory' ]) |
|
| 165 | + ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | \ No newline at end of file |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | } else { |
| 123 | 123 | $this->instance = $this->instance ?: new RedisClient(); |
| 124 | 124 | |
| 125 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 126 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379'; |
|
| 127 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 128 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : ''; |
|
| 129 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
| 125 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 126 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379'; |
|
| 127 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 128 | + $database = isset($this->config['database']) ? $this->config['database'] : ''; |
|
| 129 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
| 130 | 130 | |
| 131 | 131 | if (!$this->instance->connect($host, (int) $port, (int) $timeout)) { |
| 132 | 132 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | // used_memory |
| 158 | 158 | $info = $this->instance->info(); |
| 159 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
| 159 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
| 160 | 160 | |
| 161 | 161 | return (new driverStatistic()) |
| 162 | 162 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 163 | 163 | ->setRawData($info) |
| 164 | - ->setSize($info[ 'used_memory' ]) |
|
| 165 | - ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 164 | + ->setSize($info['used_memory']) |
|
| 165 | + ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $info['redis_version'], $date->format(DATE_RFC2822))); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | \ No newline at end of file |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | if ($item instanceof Item) { |
| 79 | 79 | try { |
| 80 | 80 | $result = (array) $this->getCollection()->update( |
| 81 | - ['_id' => $item->getKey()], |
|
| 82 | - [ |
|
| 81 | + ['_id' => $item->getKey()], |
|
| 82 | + [ |
|
| 83 | 83 | '$set' => [ |
| 84 | - self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())), |
|
| 85 | - self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
| 86 | - self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY), |
|
| 84 | + self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())), |
|
| 85 | + self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
| 86 | + self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY), |
|
| 87 | 87 | ], |
| 88 | - ], |
|
| 89 | - ['upsert' => true, 'multiple' => false] |
|
| 88 | + ], |
|
| 89 | + ['upsert' => true, 'multiple' => false] |
|
| 90 | 90 | ); |
| 91 | 91 | } catch (MongoCursorException $e) { |
| 92 | 92 | return false; |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | protected function driverRead(CacheItemInterface $item) |
| 106 | 106 | { |
| 107 | 107 | $document = $this->getCollection() |
| 108 | - ->findOne(['_id' => $item->getKey()], |
|
| 108 | + ->findOne(['_id' => $item->getKey()], |
|
| 109 | 109 | [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX, self::DRIVER_TAGS_WRAPPER_INDEX /*'d', 'e'*/]); |
| 110 | 110 | |
| 111 | 111 | if ($document) { |
| 112 | 112 | return [ |
| 113 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 114 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 115 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 113 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 114 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 115 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 116 | 116 | ]; |
| 117 | 117 | } else { |
| 118 | 118 | return null; |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | * @todo make an url builder |
| 168 | 168 | */ |
| 169 | 169 | $this->instance = $this->instance ?: (new MongodbClient('mongodb://' . |
| 170 | - ($username ?: '') . |
|
| 171 | - ($password ? ":{$password}" : '') . |
|
| 172 | - ($username ? '@' : '') . "{$host}" . |
|
| 173 | - ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 170 | + ($username ?: '') . |
|
| 171 | + ($password ? ":{$password}" : '') . |
|
| 172 | + ($username ? '@' : '') . "{$host}" . |
|
| 173 | + ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 174 | 174 | // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -196,25 +196,25 @@ discard block |
||
| 196 | 196 | public function getStats() |
| 197 | 197 | { |
| 198 | 198 | $serverStatus = $this->getCollection()->db->command([ |
| 199 | - 'serverStatus' => 1, |
|
| 200 | - 'recordStats' => 0, |
|
| 201 | - 'repl' => 0, |
|
| 202 | - 'metrics' => 0, |
|
| 199 | + 'serverStatus' => 1, |
|
| 200 | + 'recordStats' => 0, |
|
| 201 | + 'repl' => 0, |
|
| 202 | + 'metrics' => 0, |
|
| 203 | 203 | ]); |
| 204 | 204 | |
| 205 | 205 | $collStats = $this->getCollection()->db->command([ |
| 206 | - 'collStats' => 'Cache', |
|
| 207 | - 'verbose' => true, |
|
| 206 | + 'collStats' => 'Cache', |
|
| 207 | + 'verbose' => true, |
|
| 208 | 208 | ]); |
| 209 | 209 | |
| 210 | 210 | $stats = (new driverStatistic()) |
| 211 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 212 | - ->setSize((int) @$collStats[ 'size' ]) |
|
| 213 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 214 | - ->setRawData([ |
|
| 211 | + ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 212 | + ->setSize((int) @$collStats[ 'size' ]) |
|
| 213 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 214 | + ->setRawData([ |
|
| 215 | 215 | 'serverStatus' => $serverStatus, |
| 216 | 216 | 'collStats' => $collStats, |
| 217 | - ]); |
|
| 217 | + ]); |
|
| 218 | 218 | |
| 219 | 219 | return $stats; |
| 220 | 220 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @param \Psr\Cache\CacheItemInterface $item |
| 72 | - * @return mixed |
|
| 72 | + * @return boolean |
|
| 73 | 73 | * @throws \InvalidArgumentException |
| 74 | 74 | */ |
| 75 | 75 | protected function driverWrite(CacheItemInterface $item) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * @return bool |
|
| 152 | + * @return boolean|null |
|
| 153 | 153 | * @throws MongoConnectionException |
| 154 | 154 | * @throws LogicException |
| 155 | 155 | */ |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
| 87 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
| 88 | 88 | } else { |
| 89 | 89 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 90 | 90 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if ($document) { |
| 104 | 104 | return [ |
| 105 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 106 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 107 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 105 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin), |
|
| 106 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec), |
|
| 107 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin), |
|
| 108 | 108 | ]; |
| 109 | 109 | } else { |
| 110 | 110 | return null; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | if ($item instanceof Item) { |
| 125 | 125 | $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]); |
| 126 | 126 | |
| 127 | - return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ]; |
|
| 127 | + return (int) $deletionResult['ok'] === 1 && !$deletionResult['err']; |
|
| 128 | 128 | } else { |
| 129 | 129 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 130 | 130 | } |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | if ($this->instance instanceof MongodbClient) { |
| 149 | 149 | throw new LogicException('Already connected to Mongodb server'); |
| 150 | 150 | } else { |
| 151 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 152 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017'; |
|
| 153 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3; |
|
| 154 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 155 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 151 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 152 | + $port = isset($this->config['port']) ? $this->config['port'] : '27017'; |
|
| 153 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3; |
|
| 154 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 155 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | ]); |
| 201 | 201 | |
| 202 | 202 | $stats = (new driverStatistic()) |
| 203 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 204 | - ->setSize((int) @$collStats[ 'size' ]) |
|
| 203 | + ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.") |
|
| 204 | + ->setSize((int) @$collStats['size']) |
|
| 205 | 205 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 206 | 206 | ->setRawData([ |
| 207 | 207 | 'serverStatus' => $serverStatus, |