Completed
Push — v5.1 ( e1d1c0...ad5c2c )
by Georges
02:46
created
tests/AttachingDetachingMethods.test.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
 if (!is_object($driverInstance)) {
25 25
     echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n";
26 26
     $status = 1;
27
-}else if(!($driverInstance instanceof CacheItemPoolInterface)){
27
+} else if (!($driverInstance instanceof CacheItemPoolInterface)) {
28 28
     echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n";
29 29
     $status = 1;
30
-}else{
30
+} else {
31 31
     $key = 'test_attaching_detaching';
32 32
 
33 33
     $itemDetached = $driverInstance->getItem($key);
34 34
     $driverInstance->detachItem($itemDetached);
35 35
     $itemAttached = $driverInstance->getItem($key);
36 36
 
37
-    if($driverInstance->isAttached($itemDetached) !== true)
37
+    if ($driverInstance->isAttached($itemDetached) !== true)
38 38
     {
39 39
         echo '[PASS] ExtendedCacheItemPoolInterface::isAttached() identified $itemDetached as being detached.' . "\n";
40 40
     }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
         $status = 1;
45 45
     }
46 46
 
47
-    try{
47
+    try {
48 48
         $driverInstance->attachItem($itemDetached);
49 49
         echo '[FAIL] ExtendedCacheItemPoolInterface::attachItem() attached $itemDetached without trowing an error.' . "\n";
50 50
         $status = 1;
51
-    }catch(\LogicException $e){
51
+    } catch (\LogicException $e) {
52 52
         echo '[PASS] ExtendedCacheItemPoolInterface::attachItem() failed to attach $itemDetached by trowing a LogicException exception.' . "\n";
53 53
     }
54 54
 
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Devtrue/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 => true,
83
-          self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
-          self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
82
+            self::DRIVER_DATA_WRAPPER_INDEX => true,
83
+            self::DRIVER_TAGS_WRAPPER_INDEX => [],
84
+            self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(),
85 85
         ];
86 86
     }
87 87
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $stat = new driverStatistic();
133 133
         $stat->setInfo('[Devtrue] A void info string')
134
-          ->setSize(0)
135
-          ->setData(implode(', ', array_keys($this->itemInstances)))
136
-          ->setRawData(true);
134
+            ->setSize(0)
135
+            ->setData(implode(', ', array_keys($this->itemInstances)))
136
+            ->setRawData(true);
137 137
 
138 138
         return $stat;
139 139
     }
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Files/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
             /**
78 78
              * Skip if Existing Caching in Options
79 79
              */
80
-            if (isset($this->config[ 'skipExisting' ]) && $this->config[ 'skipExisting' ] == true && file_exists($file_path)) {
80
+            if (isset($this->config['skipExisting']) && $this->config['skipExisting'] == true && file_exists($file_path)) {
81 81
                 $content = $this->readfile($file_path);
82 82
                 $old = $this->decode($content);
83 83
                 $toWrite = false;
Please login to merge, or discard this patch.
src/phpFastCache/Drivers/Mongodb/Driver.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function driverCheck()
64 64
     {
65
-        if(class_exists('MongoDB\Driver\Manager')){
65
+        if (class_exists('MongoDB\Driver\Manager')) {
66 66
             trigger_error('PhpFastCache currently only support the pecl Mongo extension.<br />
67 67
             The Support for the MongoDB extension will be added coming soon.', E_USER_ERROR);
68 68
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 return false;
98 98
             }
99 99
 
100
-            return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true;
100
+            return isset($result['ok']) ? $result['ok'] == 1 : true;
101 101
         } else {
102 102
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
103 103
         }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 
116 116
         if ($document) {
117 117
             return [
118
-              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin),
119
-              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec),
120
-              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin),
118
+              self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin),
119
+              self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->sec),
120
+              self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin),
121 121
             ];
122 122
         } else {
123 123
             return null;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if ($item instanceof Item) {
138 138
             $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]);
139 139
 
140
-            return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ];
140
+            return (int) $deletionResult['ok'] === 1 && !$deletionResult['err'];
141 141
         } else {
142 142
             throw new \InvalidArgumentException('Cross-Driver type confusion detected');
143 143
         }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
         if ($this->instance instanceof MongodbClient) {
162 162
             throw new LogicException('Already connected to Mongodb server');
163 163
         } else {
164
-            $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1';
165
-            $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017';
166
-            $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3;
167
-            $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : '';
168
-            $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : '';
164
+            $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1';
165
+            $port = isset($this->config['port']) ? $this->config['port'] : '27017';
166
+            $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3;
167
+            $password = isset($this->config['password']) ? $this->config['password'] : '';
168
+            $username = isset($this->config['username']) ? $this->config['username'] : '';
169 169
 
170 170
 
171 171
             /**
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
         ]);
214 214
 
215 215
         $stats = (new driverStatistic())
216
-          ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.")
217
-          ->setSize((int) @$collStats[ 'size' ])
216
+          ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.")
217
+          ->setSize((int) @$collStats['size'])
218 218
           ->setData(implode(', ', array_keys($this->itemInstances)))
219 219
           ->setRawData([
220 220
             'serverStatus' => $serverStatus,
Please login to merge, or discard this patch.
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.