Code Duplication    Length = 19-19 lines in 2 locations

src/MongoDbStore.php 2 locations

@@ 143-161 (lines=19) @@
140
    /**
141
     * {@inheritdoc}
142
     */
143
    public function get($key, $default = null)
144
    {
145
        KeyUtil::validate($key);
146
147
        try {
148
            $document = $this->collection->findOne(
149
                array('_id' => $key),
150
                array('typeMap' => self::$typeMap)
151
            );
152
        } catch (Exception $e) {
153
            throw ReadException::forException($e);
154
        }
155
156
        if (null === $document) {
157
            return $default;
158
        }
159
160
        return $this->unserialize->__invoke($document['value']);
161
    }
162
163
    /**
164
     * {@inheritdoc}
@@ 166-184 (lines=19) @@
163
    /**
164
     * {@inheritdoc}
165
     */
166
    public function getOrFail($key)
167
    {
168
        KeyUtil::validate($key);
169
170
        try {
171
            $document = $this->collection->findOne(
172
                array('_id' => $key),
173
                array('typeMap' => self::$typeMap)
174
            );
175
        } catch (Exception $e) {
176
            throw ReadException::forException($e);
177
        }
178
179
        if (null === $document) {
180
            throw NoSuchKeyException::forKey($key);
181
        }
182
183
        return $this->unserialize->__invoke($document['value']);
184
    }
185
186
    /**
187
     * {@inheritdoc}