Code Duplication    Length = 21-21 lines in 2 locations

src/Drivers/Predis.php 1 location

@@ 103-123 (lines=21) @@
100
            $pipe->get($id);
101
        }
102
103
        foreach ($pipe->execute() as $key => $row) {
104
            if (empty($row)) {
105
                continue;
106
            }
107
108
            $id = $this->getIdentifierWithoutPrefix($identifiers[$key]);
109
110
            if (is_string($row) && !is_numeric($row)) {
111
                $source = $this->getSerializer()->unserialize($row);
112
            } else {
113
                $source = array(
114
                    'data' => $row
115
                );
116
            }
117
118
            if (array_key_exists('expiresAt', $source) && ($source['expiresAt'] < $now)) {
119
                $result[$id] = false;
120
            } else {
121
                $result[$id] = $source['data'];
122
            }
123
        }
124
125
        $this->fillNotFoundKeys($result, $identifiers);
126

src/Drivers/Redis.php 1 location

@@ 189-209 (lines=21) @@
186
                continue;
187
            }
188
189
            foreach ($mGetResult as $i => $row) {
190
                if (empty($row)) {
191
                    continue;
192
                }
193
194
                $id = $this->getIdentifierWithoutPrefix($identifiers[$i]);
195
196
                if (is_string($row) && !is_numeric($row)) {
197
                    $source = $this->getSerializer()->unserialize($row);
198
                } else {
199
                    $source = array(
200
                        'data' => $row
201
                    );
202
                }
203
204
                if (array_key_exists('expiresAt', $source) && ($source['expiresAt'] < $now)) {
205
                    $result[$id] = false;
206
                } else {
207
                    $result[$id] = $source['data'];
208
                }
209
            }
210
        }
211
212
        $this->fillNotFoundKeys($result, $identifiers);