Completed
Push — master ( 1b587d...1ebcfd )
by Mehmet
02:56
created
src/RedisCache.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
     public function __construct(array $config)
30 30
     {
31 31
         $this->handler = new Redis();
32
-        $redisConfig= $this::$defaults;
32
+        $redisConfig = $this::$defaults;
33 33
         foreach ($config as $key=>$value) {
34 34
             $redisConfig[$key] = $value;
35 35
         }
36 36
         if (file_exists('igbinary_serialize')) {
37 37
             $this->serializer = Redis::SERIALIZER_IGBINARY;
38 38
         }
39
-        if ( isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) {
39
+        if (isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) {
40 40
             return $this->connect($redisConfig);
41 41
         }
42 42
         $this->persistentConnect($redisConfig);
43 43
     }
44 44
 
45
-    private function connect( array $redisConfig){
45
+    private function connect(array $redisConfig) {
46 46
         $this->handler->connect(
47 47
             $redisConfig['host'],
48 48
             $redisConfig['port'],
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         return $this->handler->select($redisConfig['dbIndex']);
54 54
     }
55 55
 
56
-    private function persistentConnect( array $redisConfig){
56
+    private function persistentConnect(array $redisConfig) {
57 57
         $this->handler->pconnect(
58 58
             $redisConfig['host'],
59 59
             $redisConfig['port'],
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return bool True on success and false on failure
88 88
      */
89
-    public function set($key, $value, $ttl = null){
89
+    public function set($key, $value, $ttl = null) {
90 90
         $ttl = intval($ttl);
91 91
         $value = $this->serialize($value);
92
-        if($ttl ==0 ){
92
+        if ($ttl == 0) {
93 93
             return $this->handler->set($key, $value);
94 94
         }
95 95
         return $this->handler->set($key, $value, $ttl);
96 96
     }
97 97
 
98
-    private function serialize($value){
98
+    private function serialize($value) {
99 99
         return ($this->serializer === Redis::SERIALIZER_IGBINARY) ? igbinary_serialize($value) : serialize($value);
100 100
     }
101 101
 
102
-    private function unserialize($value){
102
+    private function unserialize($value) {
103 103
         return ($this->serializer === Redis::SERIALIZER_IGBINARY) ? igbinary_unserialize($value) : unserialize($value);
104 104
     }
105 105
     /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @return bool True on success and false on failure
111 111
      */
112
-    public function delete($key){
112
+    public function delete($key) {
113 113
         return (bool) $this->handler->delete($key);
114 114
     }
115 115
     /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @return bool True on success and false on failure
119 119
      */
120
-    public function clear(){
120
+    public function clear() {
121 121
         return $this->handler->flushDb();
122 122
     }
123 123
     /**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
             return $this->handler->mSet($items);
147 147
         }
148 148
 
149
-        $return =[];
149
+        $return = [];
150 150
         foreach ($items as $key=>$value) {
151
-            $return[$key] =  $this->set($key, $value, $ttl);
151
+            $return[$key] = $this->set($key, $value, $ttl);
152 152
         }
153 153
         return $return;
154 154
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function deleteMultiple($keys)
163 163
     {
164
-        $return =[];
164
+        $return = [];
165 165
         foreach ($keys as $key) {
166 166
             $return[$key] = (bool) $this->delete($key);
167 167
         }
Please login to merge, or discard this patch.