@@ -122,11 +122,11 @@ |
||
| 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; |
@@ -175,9 +175,9 @@ |
||
| 175 | 175 | $info = $this->instance->info(); |
| 176 | 176 | $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
| 177 | 177 | return (new driverStatistic()) |
| 178 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 179 | - ->setRawData($info) |
|
| 180 | - ->setSize($info['used_memory']) |
|
| 181 | - ->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))); |
|
| 178 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 179 | + ->setRawData($info) |
|
| 180 | + ->setSize($info['used_memory']) |
|
| 181 | + ->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))); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | \ No newline at end of file |
@@ -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 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $keyword = self::PREFIX . $item->getKey(); |
| 80 | 80 | $v = json_encode($this->driverPreWrap($item)); |
| 81 | 81 | |
| 82 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
| 82 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
| 83 | 83 | return false; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // return null if no caching |
| 101 | 101 | // return value if in caching |
| 102 | 102 | $keyword = self::PREFIX . $key; |
| 103 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : false; |
|
| 103 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword], true)) : false; |
|
| 104 | 104 | |
| 105 | 105 | if ($x == false) { |
| 106 | 106 | return null; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $this->driverConnect(); |
| 123 | 123 | $keyword = self::PREFIX . $key; |
| 124 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
| 124 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
| 125 | 125 | |
| 126 | 126 | return $x ? $x - time() : $x; |
| 127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($item instanceof Item) { |
| 140 | 140 | $this->driverConnect(); |
| 141 | 141 | $keyword = self::PREFIX . $item->getKey(); |
| 142 | - $_COOKIE[ $keyword ] = null; |
|
| 142 | + $_COOKIE[$keyword] = null; |
|
| 143 | 143 | |
| 144 | 144 | return @setcookie($keyword, null, -10); |
| 145 | 145 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $this->driverConnect(); |
| 157 | 157 | foreach ($_COOKIE as $keyword => $value) { |
| 158 | 158 | if (strpos($keyword, self::PREFIX) !== false) { |
| 159 | - $_COOKIE[ $keyword ] = null; |
|
| 159 | + $_COOKIE[$keyword] = null; |
|
| 160 | 160 | $result = @setcookie($keyword, null, -10); |
| 161 | 161 | if ($return !== false) { |
| 162 | 162 | $return = $result; |
@@ -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 | { |
@@ -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 | /** |
@@ -147,10 +147,10 @@ |
||
| 147 | 147 | { |
| 148 | 148 | try{ |
| 149 | 149 | $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
| 150 | - 'host' => "127.0.0.1", |
|
| 151 | - 'port' => 8888, |
|
| 152 | - 'password' => '', |
|
| 153 | - 'timeout' => 2000, |
|
| 150 | + 'host' => "127.0.0.1", |
|
| 151 | + 'port' => 8888, |
|
| 152 | + 'password' => '', |
|
| 153 | + 'timeout' => 2000, |
|
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | 156 | $host = $server[ 'host' ]; |
@@ -145,18 +145,18 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function driverConnect() |
| 147 | 147 | { |
| 148 | - try{ |
|
| 149 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [ |
|
| 148 | + try { |
|
| 149 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : [ |
|
| 150 | 150 | 'host' => "127.0.0.1", |
| 151 | 151 | 'port' => 8888, |
| 152 | 152 | 'password' => '', |
| 153 | 153 | 'timeout' => 2000, |
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | - $host = $server[ 'host' ]; |
|
| 157 | - $port = isset($server[ 'port' ]) ? (int) $server[ 'port' ] : 8888; |
|
| 158 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
| 159 | - $timeout = !empty($server[ 'timeout' ]) ? (int) $server[ 'timeout' ] : 2000; |
|
| 156 | + $host = $server['host']; |
|
| 157 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
| 158 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
| 159 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
| 160 | 160 | $this->instance = new SimpleSSDB($host, $port, $timeout); |
| 161 | 161 | if (!empty($password)) { |
| 162 | 162 | $this->instance->auth($password); |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | } else { |
| 168 | 168 | return true; |
| 169 | 169 | } |
| 170 | - }catch(SSDBException $e){ |
|
| 171 | - throw new phpFastCacheDriverException('Ssdb failed to connect with error: '. $e->getMessage(), 0 , $e); |
|
| 170 | + } catch (SSDBException $e) { |
|
| 171 | + throw new phpFastCacheDriverException('Ssdb failed to connect with error: ' . $e->getMessage(), 0, $e); |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | } else { |
| 168 | 168 | return true; |
| 169 | 169 | } |
| 170 | - }catch(SSDBException $e){ |
|
| 170 | + } catch(SSDBException $e){ |
|
| 171 | 171 | throw new phpFastCacheDriverException('Ssdb failed to connect with error: '. $e->getMessage(), 0 , $e); |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * @param $file |
|
| 118 | + * @param string $file |
|
| 119 | 119 | * @return string |
| 120 | 120 | * @throws \Exception |
| 121 | 121 | */ |
@@ -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 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (is_array($config_name)) { |
| 66 | 66 | $this->config = array_merge($this->config, $config_name); |
| 67 | 67 | } else { |
| 68 | - $this->config[ $config_name ] = $value; |
|
| 68 | + $this->config[$config_name] = $value; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function driverUnwrapData(array $wrapper) |
| 184 | 184 | { |
| 185 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
| 185 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function driverUnwrapTags(array $wrapper) |
| 193 | 193 | { |
| 194 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
| 194 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function driverUnwrapTime(array $wrapper) |
| 203 | 203 | { |
| 204 | - return $wrapper[ self::DRIVER_TIME_WRAPPER_INDEX ]; |
|
| 204 | + return $wrapper[self::DRIVER_TIME_WRAPPER_INDEX]; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | foreach ($tagsItems as $tagsItem) { |
| 256 | 256 | $data = (array) $tagsItem->get(); |
| 257 | 257 | |
| 258 | - unset($data[ $item->getKey() ]); |
|
| 258 | + unset($data[$item->getKey()]); |
|
| 259 | 259 | $tagsItem->set($data); |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | public static function isValidOption($optionName, $optionValue) |
| 308 | 308 | { |
| 309 | - if(!is_string($optionName)) |
|
| 309 | + if (!is_string($optionName)) |
|
| 310 | 310 | { |
| 311 | 311 | throw new \InvalidArgumentException('$optionName must be a string'); |
| 312 | 312 | } |
@@ -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; |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | if ($document) { |
| 110 | 110 | return [ |
| 111 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 112 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 113 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 111 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 112 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 113 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 114 | 114 | ]; |
| 115 | 115 | } else { |
| 116 | 116 | return null; |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | * @todo make an url builder |
| 166 | 166 | */ |
| 167 | 167 | $this->instance = $this->instance ?: (new MongodbClient('mongodb://' . |
| 168 | - ($username ?: '') . |
|
| 169 | - ($password ? ":{$password}" : '') . |
|
| 170 | - ($username ? '@' : '') . "{$host}" . |
|
| 171 | - ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 168 | + ($username ?: '') . |
|
| 169 | + ($password ? ":{$password}" : '') . |
|
| 170 | + ($username ? '@' : '') . "{$host}" . |
|
| 171 | + ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 172 | 172 | // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -209,25 +209,25 @@ discard block |
||
| 209 | 209 | public function getStats() |
| 210 | 210 | { |
| 211 | 211 | $serverStatus = $this->getCollection()->db->command([ |
| 212 | - 'serverStatus' => 1, |
|
| 213 | - 'recordStats' => 0, |
|
| 214 | - 'repl' => 0, |
|
| 215 | - 'metrics' => 0, |
|
| 212 | + 'serverStatus' => 1, |
|
| 213 | + 'recordStats' => 0, |
|
| 214 | + 'repl' => 0, |
|
| 215 | + 'metrics' => 0, |
|
| 216 | 216 | ]); |
| 217 | 217 | |
| 218 | 218 | $collStats = $this->getCollection()->db->command([ |
| 219 | - 'collStats' => 'Cache', |
|
| 220 | - 'verbose' => true, |
|
| 219 | + 'collStats' => 'Cache', |
|
| 220 | + 'verbose' => true, |
|
| 221 | 221 | ]); |
| 222 | 222 | |
| 223 | 223 | $stats = (new driverStatistic()) |
| 224 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 225 | - ->setSize((int) $collStats[ 'size' ]) |
|
| 226 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 227 | - ->setRawData([ |
|
| 224 | + ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 225 | + ->setSize((int) $collStats[ 'size' ]) |
|
| 226 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 227 | + ->setRawData([ |
|
| 228 | 228 | 'serverStatus' => $serverStatus, |
| 229 | 229 | 'collStats' => $collStats, |
| 230 | - ]); |
|
| 230 | + ]); |
|
| 231 | 231 | |
| 232 | 232 | return $stats; |
| 233 | 233 | } |
@@ -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) |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
| 95 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
| 96 | 96 | } else { |
| 97 | 97 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 98 | 98 | } |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | if ($document) { |
| 110 | 110 | return [ |
| 111 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 112 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
| 113 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 111 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin), |
|
| 112 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec), |
|
| 113 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin), |
|
| 114 | 114 | ]; |
| 115 | 115 | } else { |
| 116 | 116 | return null; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if ($item instanceof Item) { |
| 131 | 131 | $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]); |
| 132 | 132 | |
| 133 | - return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ]; |
|
| 133 | + return (int) $deletionResult['ok'] === 1 && !$deletionResult['err']; |
|
| 134 | 134 | } else { |
| 135 | 135 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 136 | 136 | } |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | if ($this->instance instanceof MongodbClient) { |
| 155 | 155 | throw new LogicException('Already connected to Mongodb server'); |
| 156 | 156 | } else { |
| 157 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 158 | - $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017'; |
|
| 159 | - $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3; |
|
| 160 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 161 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 157 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 158 | + $port = isset($server['port']) ? $server['port'] : '27017'; |
|
| 159 | + $timeout = isset($server['timeout']) ? $server['timeout'] : 3; |
|
| 160 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 161 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | ]); |
| 207 | 207 | |
| 208 | 208 | $stats = (new driverStatistic()) |
| 209 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 210 | - ->setSize((int) $collStats[ 'size' ]) |
|
| 209 | + ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.") |
|
| 210 | + ->setSize((int) $collStats['size']) |
|
| 211 | 211 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 212 | 212 | ->setRawData([ |
| 213 | 213 | 'serverStatus' => $serverStatus, |
@@ -154,9 +154,9 @@ |
||
| 154 | 154 | $stats = (array) apc_cache_info('user'); |
| 155 | 155 | $date = (new \DateTime())->setTimestamp($stats['start_time']); |
| 156 | 156 | return (new driverStatistic()) |
| 157 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 158 | - ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries'])) |
|
| 159 | - ->setRawData($stats) |
|
| 160 | - ->setSize($stats['mem_size']); |
|
| 157 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 158 | + ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries'])) |
|
| 159 | + ->setRawData($stats) |
|
| 160 | + ->setSize($stats['mem_size']); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | \ No newline at end of file |
@@ -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) { |
@@ -81,8 +81,7 @@ discard block |
||
| 81 | 81 | return unlink($source); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $files = new RecursiveIteratorIterator |
|
| 85 | - ( |
|
| 84 | + $files = new RecursiveIteratorIterator( |
|
| 86 | 85 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
| 87 | 86 | RecursiveIteratorIterator::CHILD_FIRST |
| 88 | 87 | ); |
@@ -95,7 +94,7 @@ discard block |
||
| 95 | 94 | if (self::rrmdir($fileinfo->getRealPath()) === false) { |
| 96 | 95 | return false; |
| 97 | 96 | } |
| 98 | - } else if(unlink($fileinfo->getRealPath()) === false) { |
|
| 97 | + } else if (unlink($fileinfo->getRealPath()) === false) { |
|
| 99 | 98 | return false; |
| 100 | 99 | } |
| 101 | 100 | } |