Completed
Push — V6 ( 8533dc...481103 )
by Georges
02:36
created
src/phpFastCache/Helper/Psr16Adapter.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@
 block discarded – undo
63 63
     {
64 64
         try {
65 65
             $cacheItem = $this->internalCacheInstance
66
-              ->getItem($key)
67
-              ->set($value);
66
+                ->getItem($key)
67
+                ->set($value);
68 68
             if (is_int($ttl) || $ttl instanceof \DateInterval) {
69 69
                 $cacheItem->expiresAfter($ttl);
70 70
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
     public function getMultiple($keys, $default = null)
111 111
     {
112 112
         try {
113
-            return array_map(function (ExtendedCacheItemInterface $item) {
113
+            return array_map(function(ExtendedCacheItemInterface $item) {
114 114
                 return $item->get();
115 115
             }, $this->internalCacheInstance->getItems($keys));
116 116
         } catch (phpFastCacheInvalidArgumentException $e) {
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cassandra/Driver.php 4 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
             if($results instanceof Cassandra\Rows && $results->count() === 1){
132 132
                 return $this->decode($results->first()['cache_data']);
133
-            }else{
133
+            } else{
134 134
                 return null;
135 135
             }
136 136
         } catch (Cassandra\Exception $e) {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             if(!empty($this->config['ssl']['enabled'])){
218 218
                 if(!empty($this->config['ssl']['verify'])){
219 219
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
220
-                }else{
220
+                } else{
221 221
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
222 222
                 }
223 223
 
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
         if ($item instanceof Item) {
74 74
             $cacheData = $this->encode($this->driverPreWrap($item));
75 75
             $options = new Cassandra\ExecutionOptions([
76
-              'arguments' => [
77
-                  'cache_uuid' => new Cassandra\Uuid(),
78
-                  'cache_id' => $item->getKey(),
79
-                  'cache_data' => $cacheData,
80
-                  'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
81
-                  'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
82
-                  'cache_length' => strlen($cacheData)
76
+                'arguments' => [
77
+                    'cache_uuid' => new Cassandra\Uuid(),
78
+                    'cache_id' => $item->getKey(),
79
+                    'cache_data' => $cacheData,
80
+                    'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()),
81
+                    'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()),
82
+                    'cache_length' => strlen($cacheData)
83 83
                 ],
84
-              'consistency' => Cassandra::CONSISTENCY_ALL,
85
-              'serial_consistency' => Cassandra::CONSISTENCY_SERIAL
84
+                'consistency' => Cassandra::CONSISTENCY_ALL,
85
+                'serial_consistency' => Cassandra::CONSISTENCY_SERIAL
86 86
             ]);
87 87
 
88 88
             $query = sprintf('INSERT INTO %s.%s
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
     {
118 118
         try {
119 119
             $options = new Cassandra\ExecutionOptions([
120
-              'arguments' => ['cache_id' => $item->getKey()],
121
-              'page_size' => 1
120
+                'arguments' => ['cache_id' => $item->getKey()],
121
+                'page_size' => 1
122 122
             ]);
123 123
             $query = sprintf(
124
-              'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
-              self::CASSANDRA_KEY_SPACE,
126
-              self::CASSANDRA_TABLE
124
+                'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;',
125
+                self::CASSANDRA_KEY_SPACE,
126
+                self::CASSANDRA_TABLE
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
         if ($item instanceof Item) {
151 151
             try {
152 152
                 $options = new Cassandra\ExecutionOptions([
153
-                  'arguments' => [
153
+                    'arguments' => [
154 154
                     'cache_id' => $item->getKey(),
155
-                  ],
155
+                    ],
156 156
                 ]);
157 157
                 $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
158
-                  'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
159
-                  self::CASSANDRA_KEY_SPACE,
160
-                  self::CASSANDRA_TABLE
158
+                    'DELETE FROM %s.%s WHERE cache_id = :cache_id;',
159
+                    self::CASSANDRA_KEY_SPACE,
160
+                    self::CASSANDRA_TABLE
161 161
                 )), $options);
162 162
 
163 163
                 /**
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
     {
182 182
         try {
183 183
             $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
184
-              'TRUNCATE %s.%s;',
185
-              self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
184
+                'TRUNCATE %s.%s;',
185
+                self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE
186 186
             )));
187 187
             /**
188 188
              * There's no real way atm
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
             $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
211 211
 
212 212
             $clusterBuilder = Cassandra::cluster()
213
-              ->withContactPoints($host)
214
-              ->withPort($port);
213
+                ->withContactPoints($host)
214
+                ->withPort($port);
215 215
 
216 216
             if(!empty($this->config['ssl']['enabled'])){
217 217
                 if(!empty($this->config['ssl']['verify'])){
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
              */
240 240
 
241 241
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
242
-              "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
243
-              self::CASSANDRA_KEY_SPACE
242
+                "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };",
243
+                self::CASSANDRA_KEY_SPACE
244 244
             )));
245 245
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE)));
246 246
             $this->instance->execute(new Cassandra\SimpleStatement(sprintf('
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
     public function getStats()
287 287
     {
288 288
         $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf(
289
-          'SELECT SUM(cache_length) as cache_size FROM %s.%s',
290
-          self::CASSANDRA_KEY_SPACE,
291
-          self::CASSANDRA_TABLE
289
+            'SELECT SUM(cache_length) as cache_size FROM %s.%s',
290
+            self::CASSANDRA_KEY_SPACE,
291
+            self::CASSANDRA_TABLE
292 292
         )));
293 293
 
294 294
         return (new driverStatistic())
295
-          ->setSize($result->first()[ 'cache_size' ])
296
-          ->setRawData([])
297
-          ->setData(implode(', ', array_keys($this->itemInstances)))
298
-          ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
295
+            ->setSize($result->first()[ 'cache_size' ])
296
+            ->setRawData([])
297
+            ->setData(implode(', ', array_keys($this->itemInstances)))
298
+            ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
299 299
     }
300 300
 }
301 301
\ No newline at end of file
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.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
             );
128 128
             $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options);
129 129
 
130
-            if($results instanceof Cassandra\Rows && $results->count() === 1){
130
+            if ($results instanceof Cassandra\Rows && $results->count() === 1) {
131 131
                 return $this->decode($results->first()['cache_data']);
132
-            }else{
132
+            } else {
133 133
                 return null;
134 134
             }
135 135
         } catch (Cassandra\Exception $e) {
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
         if ($this->instance instanceof CassandraSession) {
204 204
             throw new \LogicException('Already connected to Couchbase server');
205 205
         } else {
206
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
207
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042;
208
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2;
209
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
210
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
206
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
207
+            $port = isset($this->config['port']) ? $this->config['port'] : 9042;
208
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2;
209
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
210
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
211 211
 
212 212
             $clusterBuilder = Cassandra::cluster()
213 213
               ->withContactPoints($host)
214 214
               ->withPort($port);
215 215
 
216
-            if(!empty($this->config['ssl']['enabled'])){
217
-                if(!empty($this->config['ssl']['verify'])){
216
+            if (!empty($this->config['ssl']['enabled'])) {
217
+                if (!empty($this->config['ssl']['verify'])) {
218 218
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT);
219
-                }else{
219
+                } else {
220 220
                     $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE);
221 221
                 }
222 222
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
             $clusterBuilder->withConnectTimeout($timeout);
227 227
 
228
-            if($username){
228
+            if ($username) {
229 229
                 $clusterBuilder->withCredentials($username, $password);
230 230
             }
231 231
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         )));
293 293
 
294 294
         return (new driverStatistic())
295
-          ->setSize($result->first()[ 'cache_size' ])
295
+          ->setSize($result->first()['cache_size'])
296 296
           ->setRawData([])
297 297
           ->setData(implode(', ', array_keys($this->itemInstances)))
298 298
           ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.');
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     /**
62 62
      * @param \Psr\Cache\CacheItemInterface $item
63
-     * @return mixed
63
+     * @return boolean
64 64
      * @throws phpFastCacheInvalidArgumentException
65 65
      */
66 66
     protected function driverWrite(CacheItemInterface $item)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      * @param string $optionName
148 148
      * @param mixed $optionValue
149
-     * @return bool
149
+     * @return boolean|null
150 150
      * @throws phpFastCacheInvalidArgumentException
151 151
      */
152 152
     public static function isValidOption($optionName, $optionValue)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 
181 181
     /**
182
-     * @return array
182
+     * @return string[]
183 183
      */
184 184
     public static function getValidOptions()
185 185
     {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     /**
190
-     * @return array
190
+     * @return string[]
191 191
      */
192 192
     public static function getRequiredOptions()
193 193
     {
Please login to merge, or discard this patch.
src/phpFastCache/EventManager.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     public function dispatch($eventName, ...$args)
70 70
     {
71 71
         $eventName = 'on' . ucfirst($eventName);
72
-        if(array_key_exists($eventName, $this->events)){
73
-            foreach ($this->events[ $eventName ] as $event) {
72
+        if (array_key_exists($eventName, $this->events)) {
73
+            foreach ($this->events[$eventName] as $event) {
74 74
                 call_user_func_array($event, $args);
75 75
             }
76 76
         }
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function __call($name, $arguments)
86 86
     {
87
-        if(strpos($name, 'on') === 0){
88
-            if(is_callable($arguments[0])){
89
-                if(isset($arguments[1]) && is_string($arguments[0])){
87
+        if (strpos($name, 'on') === 0) {
88
+            if (is_callable($arguments[0])) {
89
+                if (isset($arguments[1]) && is_string($arguments[0])) {
90 90
                     $this->events[$name][$arguments[1]] = $arguments[0];
91
-                }else {
91
+                } else {
92 92
                     $this->events[$name][] = $arguments[0];
93 93
                 }
94
-            }else{
94
+            } else {
95 95
                 throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0])));
96 96
             }
97
-        }else{
97
+        } else {
98 98
             throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
99 99
         }
100 100
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function unbindEventCallback($eventName, $callbackName)
108 108
     {
109
-        if(isset($this->events[$eventName][$callbackName])){
109
+        if (isset($this->events[$eventName][$callbackName])) {
110 110
             unset($this->events[$eventName][$callbackName]);
111 111
             return true;
112 112
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,13 +88,13 @@
 block discarded – undo
88 88
             if(is_callable($arguments[0])){
89 89
                 if(isset($arguments[1]) && is_string($arguments[0])){
90 90
                     $this->events[$name][$arguments[1]] = $arguments[0];
91
-                }else {
91
+                } else {
92 92
                     $this->events[$name][] = $arguments[0];
93 93
                 }
94
-            }else{
94
+            } else{
95 95
                 throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0])));
96 96
             }
97
-        }else{
97
+        } else{
98 98
             throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"');
99 99
         }
100 100
     }
Please login to merge, or discard this patch.
src/phpFastCache/Core/Item/ItemExtendedTrait.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function getCreationDate()
83 83
     {
84
-        if($this->driver->getConfig()['itemDetailedDate']){
84
+        if ($this->driver->getConfig()['itemDetailedDate']) {
85 85
             return $this->creationDate;
86
-        }else{
86
+        } else {
87 87
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
88 88
         }
89 89
     }
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function setCreationDate(\DateTimeInterface $date)
97 97
     {
98
-        if($this->driver->getConfig()['itemDetailedDate']){
98
+        if ($this->driver->getConfig()['itemDetailedDate']) {
99 99
             $this->creationDate = $date;
100 100
             return $this;
101
-        }else{
101
+        } else {
102 102
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
103 103
         }
104 104
     }
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getModificationDate()
111 111
     {
112
-        if($this->driver->getConfig()['itemDetailedDate']){
112
+        if ($this->driver->getConfig()['itemDetailedDate']) {
113 113
             return $this->modificationDate;
114
-        }else{
114
+        } else {
115 115
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
116 116
         }
117 117
     }
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function setModificationDate(\DateTimeInterface $date)
125 125
     {
126
-        if($this->driver->getConfig()['itemDetailedDate']){
126
+        if ($this->driver->getConfig()['itemDetailedDate']) {
127 127
             $this->modificationDate = $date;
128 128
             return $this;
129
-        }else{
129
+        } else {
130 130
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
131 131
         }
132 132
     }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     public function removeTag($tagName)
294 294
     {
295 295
         if (($key = array_search($tagName, $this->tags)) !== false) {
296
-            unset($this->tags[ $key ]);
296
+            unset($this->tags[$key]);
297 297
             $this->removedTags[] = $tagName;
298 298
         }
299 299
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     final public function __debugInfo()
370 370
     {
371 371
         $info = get_object_vars($this);
372
-        $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
372
+        $info['driver'] = 'object(' . get_class($info['driver']) . ')';
373 373
 
374 374
         return (array) $info;
375 375
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         if($this->driver->getConfig()['itemDetailedDate']){
85 85
             return $this->creationDate;
86
-        }else{
86
+        } else{
87 87
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
88 88
         }
89 89
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         if($this->driver->getConfig()['itemDetailedDate']){
99 99
             $this->creationDate = $date;
100 100
             return $this;
101
-        }else{
101
+        } else{
102 102
             throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.');
103 103
         }
104 104
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         if($this->driver->getConfig()['itemDetailedDate']){
113 113
             return $this->modificationDate;
114
-        }else{
114
+        } else{
115 115
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
116 116
         }
117 117
     }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         if($this->driver->getConfig()['itemDetailedDate']){
127 127
             $this->modificationDate = $date;
128 128
             return $this;
129
-        }else{
129
+        } else{
130 130
             throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.');
131 131
         }
132 132
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Cookie/Item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             $this->driver->setItem($this);
44 44
         } else {
45 45
             throw new phpFastCacheInvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.',
46
-              gettype($key)));
46
+                gettype($key)));
47 47
         }
48 48
     }
49 49
 
Please login to merge, or discard this patch.