Completed
Pull Request — final (#410)
by Georges
05:20 queued 03:09
created
src/phpFastCache/Drivers/Devnull/Driver.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     protected function driverRead(CacheItemInterface $item)
78 78
     {
79 79
         return [
80
-          self::DRIVER_DATA_WRAPPER_INDEX => null,
81
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
82
-          self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
80
+            self::DRIVER_DATA_WRAPPER_INDEX => null,
81
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
82
+            self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
83 83
         ];
84 84
     }
85 85
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $stat = new driverStatistic();
131 131
         $stat->setInfo('[Devnull] A void info string')
132
-          ->setSize(0)
133
-          ->setData(implode(', ', array_keys($this->itemInstances)))
134
-          ->setRawData(null);
132
+            ->setSize(0)
133
+            ->setData(implode(', ', array_keys($this->itemInstances)))
134
+            ->setRawData(null);
135 135
 
136 136
         return $stat;
137 137
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devfalse/Driver.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     protected function driverRead(CacheItemInterface $item)
80 80
     {
81 81
         return [
82
-          self::DRIVER_DATA_WRAPPER_INDEX => false,
83
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
-          self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
82
+            self::DRIVER_DATA_WRAPPER_INDEX => false,
83
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
+            self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
85 85
         ];
86 86
     }
87 87
     /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $stat = new driverStatistic();
132 132
         $stat->setInfo('[Devfalse] A void info string')
133
-          ->setSize(0)
134
-          ->setData(implode(', ', array_keys($this->itemInstances)))
135
-          ->setRawData(false);
133
+            ->setSize(0)
134
+            ->setData(implode(', ', array_keys($this->itemInstances)))
135
+            ->setRawData(false);
136 136
 
137 137
         return $stat;
138 138
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Zendshm/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,8 +130,8 @@
 block discarded – undo
130 130
      */
131 131
     public function getStats()
132 132
     {
133
-        if(function_exists('zend_shm_cache_info')) {
134
-            $stats = (array)zend_shm_cache_info();
133
+        if (function_exists('zend_shm_cache_info')) {
134
+            $stats = (array) zend_shm_cache_info();
135 135
             return (new driverStatistic())
136 136
                 ->setData(implode(', ', array_keys($this->namespaces)))
137 137
                 ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total']))
Please login to merge, or discard this patch.
tests/ReadWriteOperations.test.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
 $keys = [];
24 24
 
25 25
 $dirs = [
26
-  __DIR__ . '/../var/cache/IO-',
27
-  sys_get_temp_dir() . '/phpfastcache/IO-1',
28
-  sys_get_temp_dir() . '/phpfastcache/IO-2'
26
+    __DIR__ . '/../var/cache/IO-',
27
+    sys_get_temp_dir() . '/phpfastcache/IO-1',
28
+    sys_get_temp_dir() . '/phpfastcache/IO-2'
29 29
 ];
30 30
 
31 31
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
     {
40 40
         $cacheInstanceName = 'cacheInstance' . $i;
41 41
 
42
-        $instances[$dirIndex][$cacheInstanceName] = CacheManager::getInstance('Files',array('path' => $dir . str_pad($i, 3, '0', STR_PAD_LEFT)));
42
+        $instances[$dirIndex][$cacheInstanceName] = CacheManager::getInstance('Files', array('path' => $dir . str_pad($i, 3, '0', STR_PAD_LEFT)));
43 43
 
44
-        foreach($keys[$dirIndex] as $index => $key)
44
+        foreach ($keys[$dirIndex] as $index => $key)
45 45
         {
46 46
             $items[$dirIndex][$index] = $instances[$dirIndex][$cacheInstanceName]->getItem($key);
47 47
             $items[$dirIndex][$index]->set("test-$dirIndex-$index")->expiresAfter(600);
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
         $instances[$dirIndex][$cacheInstanceName]->detachAllItems();
52 52
     }
53 53
 
54
-    foreach($instances[$dirIndex] as $cacheInstanceName => $instance)
54
+    foreach ($instances[$dirIndex] as $cacheInstanceName => $instance)
55 55
     {
56
-        foreach($keys[$dirIndex] as $index => $key)
56
+        foreach ($keys[$dirIndex] as $index => $key)
57 57
         {
58
-            if($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index")
58
+            if ($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index")
59 59
             {
60 60
                 echo "[PASS] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} has returned the expected value (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "')\n";
61 61
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
             if($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index")
59 59
             {
60 60
                 echo "[PASS] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} has returned the expected value (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "')\n";
61
-            }
62
-            else
61
+            } else
63 62
             {
64 63
                 echo "[FAIL] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} returned an unexpected value (" . gettype($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get()) . ":'" . $instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() . "') expected (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "') \n";
65 64
                 $status = 255;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Driver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Predis/Driver.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         $config = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [];
126 126
 
127 127
         $this->instance = new PredisClient(array_merge([
128
-          'host' => '127.0.0.1',
129
-          'port' => '6379',
130
-          'password' => '',
131
-          'database' => '',
128
+            'host' => '127.0.0.1',
129
+            'port' => '6379',
130
+            'password' => '',
131
+            'database' => '',
132 132
         ], $config));
133 133
 
134 134
         return true;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
152 152
 
153 153
         return (new driverStatistic())
154
-          ->setData(implode(', ', array_keys($this->itemInstances)))
155
-          ->setRawData($this->instance->info())
156
-          ->setSize($size)
157
-          ->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.", $version, $date->format(DATE_RFC2822)));
154
+            ->setData(implode(', ', array_keys($this->itemInstances)))
155
+            ->setRawData($this->instance->info())
156
+            ->setSize($size)
157
+            ->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.", $version, $date->format(DATE_RFC2822)));
158 158
     }
159 159
 }
160 160
\ 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
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     protected function driverConnect()
124 124
     {
125
-        $config = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : [];
125
+        $config = isset($this->config['redis']) ? $this->config['redis'] : [];
126 126
 
127 127
         $this->instance = new PredisClient(array_merge([
128 128
           'host' => '127.0.0.1',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $info = $this->instance->info();
149 149
         $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
150 150
         $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
151
-        $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
151
+        $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');
152 152
 
153 153
         return (new driverStatistic())
154 154
           ->setData(implode(', ', array_keys($this->itemInstances)))
Please login to merge, or discard this patch.