Completed
Push — V6 ( 5d3acf...b4a639 )
by Georges
02:32
created
src/phpFastCache/Util/Directory.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devnull/Driver.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,9 +140,9 @@
 block discarded – undo
140 140
     {
141 141
         $stat = new driverStatistic();
142 142
         $stat->setInfo('[Devnull] A void info string')
143
-          ->setSize(0)
144
-          ->setData(implode(', ', array_keys($this->itemInstances)))
145
-          ->setRawData(null);
143
+            ->setSize(0)
144
+            ->setData(implode(', ', array_keys($this->itemInstances)))
145
+            ->setRawData(null);
146 146
 
147 147
         return $stat;
148 148
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
     /**
64 64
      * @param \Psr\Cache\CacheItemInterface $item
65
-     * @return mixed
65
+     * @return boolean
66 66
      * @throws phpFastCacheInvalidArgumentException
67 67
      */
68 68
     protected function driverWrite(CacheItemInterface $item)
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Redis/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,9 +159,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Memcached/Driver.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
131 131
         if (count($servers) < 1) {
132 132
             $servers = [
133
-              ['127.0.0.1', 11211],
133
+                ['127.0.0.1', 11211],
134 134
             ];
135 135
         }
136 136
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
         $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
161 161
 
162 162
         return (new driverStatistic())
163
-          ->setData(implode(', ', array_keys($this->itemInstances)))
164
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
165
-          ->setRawData($stats)
166
-          ->setSize($stats[ 'bytes' ]);
163
+            ->setData(implode(', ', array_keys($this->itemInstances)))
164
+            ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
165
+            ->setRawData($stats)
166
+            ->setSize($stats[ 'bytes' ]);
167 167
     }
168 168
 }
169 169
\ 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
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function driverConnect()
129 129
     {
130
-        $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []);
130
+        $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []);
131 131
         if (count($servers) < 1) {
132 132
             $servers = [
133 133
               ['127.0.0.1', 11211],
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 
137 137
         foreach ($servers as $server) {
138 138
             try {
139
-                if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) {
139
+                if (!$this->instance->addServer($server[0], $server[1])) {
140 140
                     $this->fallback = true;
141 141
                 }
142
-                if(!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password'])){
143
-                    $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password']);
142
+                if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) {
143
+                    $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']);
144 144
                 }
145 145
             } catch (\Exception $e) {
146 146
                 $this->fallback = true;
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
     public function getStats()
161 161
     {
162 162
         $stats = (array) $this->instance->getStats();
163
-        $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
164
-        $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
165
-        $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
163
+        $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0);
164
+        $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion');
165
+        $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0);
166 166
 
167
-        $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
167
+        $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']);
168 168
 
169 169
         return (new driverStatistic())
170 170
           ->setData(implode(', ', array_keys($this->itemInstances)))
171
-          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822)))
171
+          ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822)))
172 172
           ->setRawData($stats)
173
-          ->setSize($stats[ 'bytes' ]);
173
+          ->setSize($stats['bytes']);
174 174
     }
175 175
 }
176 176
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apcu/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@
 block discarded – undo
136 136
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137 137
 
138 138
         return (new driverStatistic())
139
-          ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->setInfo(sprintf("The APCU 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' ]))
141
-          ->setRawData($stats)
142
-          ->setSize($stats[ 'mem_size' ]);
139
+            ->setData(implode(', ', array_keys($this->itemInstances)))
140
+            ->setInfo(sprintf("The APCU 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' ]))
141
+            ->setRawData($stats)
142
+            ->setSize($stats[ 'mem_size' ]);
143 143
     }
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,12 +134,12 @@
 block discarded – undo
134 134
     public function getStats()
135 135
     {
136 136
         $stats = (array) apcu_cache_info();
137
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
138 138
 
139 139
         return (new driverStatistic())
140 140
           ->setData(implode(', ', array_keys($this->itemInstances)))
141
-          ->setInfo(sprintf("The APCU 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' ]))
141
+          ->setInfo(sprintf("The APCU 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']))
142 142
           ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
143
+          ->setSize($stats['mem_size']);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Wincache/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,9 +132,9 @@
 block discarded – undo
132 132
         $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
133 133
 
134 134
         return (new driverStatistic())
135
-          ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
-          ->setData(implode(', ', array_keys($this->itemInstances)))
138
-          ->setRawData($memInfo);
135
+            ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
+            ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
137
+            ->setData(implode(', ', array_keys($this->itemInstances)))
138
+            ->setRawData($memInfo);
139 139
     }
140 140
 }
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,11 +129,11 @@
 block discarded – undo
129 129
     {
130 130
         $memInfo = wincache_ucache_meminfo();
131 131
         $info = wincache_ucache_info();
132
-        $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]);
132
+        $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']);
133 133
 
134 134
         return (new driverStatistic())
135 135
           ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822)))
136
-          ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ])
136
+          ->setSize($memInfo['memory_free'] - $memInfo['memory_total'])
137 137
           ->setData(implode(', ', array_keys($this->itemInstances)))
138 138
           ->setRawData($memInfo);
139 139
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Xcache/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@
 block discarded – undo
136 136
             $info = xcache_info(XC_TYPE_VAR, 0);
137 137
 
138 138
             return (new driverStatistic())
139
-              ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
140
-              ->setData(implode(', ', array_keys($this->itemInstances)))
141
-              ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142
-              ->setRawData($info);
139
+                ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
140
+                ->setData(implode(', ', array_keys($this->itemInstances)))
141
+                ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142
+                ->setRawData($info);
143 143
         } else {
144 144
             throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n
145 145
             [xcache.admin]
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
             $info = xcache_info(XC_TYPE_VAR, 0);
137 137
 
138 138
             return (new driverStatistic())
139
-              ->setSize(abs($info[ 'size' ] - $info[ 'avail' ]))
139
+              ->setSize(abs($info['size'] - $info['avail']))
140 140
               ->setData(implode(', ', array_keys($this->itemInstances)))
141 141
               ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES)))
142 142
               ->setRawData($info);
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Apc/Driver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,10 +136,10 @@
 block discarded – undo
136 136
         $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
137 137
 
138 138
         return (new driverStatistic())
139
-          ->setData(implode(', ', array_keys($this->itemInstances)))
140
-          ->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),
139
+            ->setData(implode(', ', array_keys($this->itemInstances)))
140
+            ->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),
141 141
             $stats[ 'num_entries' ]))
142
-          ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
142
+            ->setRawData($stats)
143
+            ->setSize($stats[ 'mem_size' ]);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@
 block discarded – undo
133 133
     public function getStats()
134 134
     {
135 135
         $stats = (array) apc_cache_info('user');
136
-        $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]);
136
+        $date = (new \DateTime())->setTimestamp($stats['start_time']);
137 137
 
138 138
         return (new driverStatistic())
139 139
           ->setData(implode(', ', array_keys($this->itemInstances)))
140 140
           ->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),
141
-            $stats[ 'num_entries' ]))
141
+            $stats['num_entries']))
142 142
           ->setRawData($stats)
143
-          ->setSize($stats[ 'mem_size' ]);
143
+          ->setSize($stats['mem_size']);
144 144
     }
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Ssdb/Driver.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
     {
140 140
         try {
141 141
             $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : [
142
-              'host' => "127.0.0.1",
143
-              'port' => 8888,
144
-              'password' => '',
145
-              'timeout' => 2000,
142
+                'host' => "127.0.0.1",
143
+                'port' => 8888,
144
+                'password' => '',
145
+                'timeout' => 2000,
146 146
             ];
147 147
 
148 148
             $host = $server[ 'host' ];
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
          * using hardcoded offset of pair key-value :-(
184 184
          */
185 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
-          ->setRawData($info)
187
-          ->setData(implode(', ', array_keys($this->itemInstances)))
188
-          ->setSize($this->instance->dbsize());
186
+            ->setRawData($info)
187
+            ->setData(implode(', ', array_keys($this->itemInstances)))
188
+            ->setSize($this->instance->dbsize());
189 189
 
190 190
         return $stat;
191 191
     }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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());
Please login to merge, or discard this patch.