Completed
Pull Request — final (#446)
by Georges
02:34
created
src/phpFastCache/Drivers/Memcache/Driver.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     /**
69 69
      * @param \Psr\Cache\CacheItemInterface $item
70
-     * @return mixed
70
+     * @return boolean
71 71
      * @throws \InvalidArgumentException
72 72
      */
73 73
     protected function driverWrite(CacheItemInterface $item)
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     }
124 124
 
125 125
     /**
126
-     * @return bool
126
+     * @return boolean|null
127 127
      */
128 128
     protected function driverConnect()
129 129
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
         $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
133 133
         if (count($servers) < 1) {
134 134
             $servers = [
135
-              [
135
+                [
136 136
                 'host' =>'127.0.0.1',
137 137
                 'port' => 11211,
138 138
                 'sasl_user' => false,
139 139
                 'sasl_password' => false
140
-              ],
140
+                ],
141 141
             ];
142 142
         }
143 143
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
175 175
 
176 176
         return (new driverStatistic())
177
-          ->setData(implode(', ', array_keys($this->itemInstances)))
178
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
179
-          ->setRawData($stats)
180
-          ->setSize($stats[ 'bytes' ]);
177
+            ->setData(implode(', ', array_keys($this->itemInstances)))
178
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
179
+            ->setRawData($stats)
180
+            ->setSize($stats[ 'bytes' ]);
181 181
     }
182 182
 }
183 183
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         } else {
52 52
             $this->driverConnect();
53 53
 
54
-            if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) {
54
+            if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) {
55 55
                 $this->memcacheFlags = MEMCACHE_COMPRESSED;
56 56
             }
57 57
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $this->instance = new MemcacheSoftware();
131 131
 
132
-        $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
132
+        $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []);
133 133
         if (count($servers) < 1) {
134 134
             $servers = [
135 135
               [
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
                 if (!$this->instance->addServer($server['host'], $server['port'])) {
147 147
                     $this->fallback = true;
148 148
                 }
149
-                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
150
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
149
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
150
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
151 151
                 }
152 152
             } catch (\Exception $e) {
153 153
                 $this->fallback = true;
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
     public function getStats()
168 168
     {
169 169
         $stats = (array) $this->instance->getstats();
170
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
171
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
172
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
170
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
171
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
172
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
173 173
         
174
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
174
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
175 175
 
176 176
         return (new driverStatistic())
177 177
           ->setData(implode(', ', array_keys($this->itemInstances)))
178
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
178
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
179 179
           ->setRawData($stats)
180
-          ->setSize($stats[ 'bytes' ]);
180
+          ->setSize($stats['bytes']);
181 181
     }
182 182
 }
183 183
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcached/Driver.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
         $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134
-              [
134
+                [
135 135
                 'host' =>'127.0.0.1',
136 136
                 'port' => 11211,
137 137
                 'sasl_user' => false,
138 138
                 'sasl_password' => false
139
-              ],
139
+                ],
140 140
             ];
141 141
         }
142 142
 
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
174 174
 
175 175
         return (new driverStatistic())
176
-          ->setData(implode(', ', array_keys($this->itemInstances)))
177
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
178
-          ->setRawData($stats)
179
-          ->setSize($stats[ 'bytes' ]);
176
+            ->setData(implode(', ', array_keys($this->itemInstances)))
177
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
178
+            ->setRawData($stats)
179
+            ->setSize($stats[ 'bytes' ]);
180 180
     }
181 181
 }
182 182
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $this->instance = new MemcachedSoftware();
130 130
 
131
-        $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []);
131
+        $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []);
132 132
         if (count($servers) < 1) {
133 133
             $servers = [
134 134
               [
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
                 if (!$this->instance->addServer($server['host'], $server['port'])) {
146 146
                     $this->fallback = true;
147 147
                 }
148
-                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
149
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
148
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
149
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
150 150
                 }
151 151
             } catch (\Exception $e) {
152 152
                 $this->fallback = true;
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
     public function getStats()
167 167
     {
168 168
         $stats = (array) $this->instance->getStats();
169
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
170
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
171
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
169
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
170
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
171
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
172 172
 
173
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
173
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
174 174
 
175 175
         return (new driverStatistic())
176 176
           ->setData(implode(', ', array_keys($this->itemInstances)))
177
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
177
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
178 178
           ->setRawData($stats)
179
-          ->setSize($stats[ 'bytes' ]);
179
+          ->setSize($stats['bytes']);
180 180
     }
181 181
 }
182 182
\ No newline at end of file
Please login to merge, or discard this patch.