Code Duplication    Length = 21-22 lines in 2 locations

src/Xhgui/Storage/Mongo.php 2 locations

@@ 255-276 (lines=22) @@
252
     * @param $name
253
     * @return bool
254
     */
255
    public function addWatchedFunction($name)
256
    {
257
258
        $name = trim($name);
259
        if (empty($name)) {
260
            return false;
261
        }
262
263
        try {
264
            $id = new \MongoId();
265
266
            $data = [
267
                '_id'   => $id,
268
                'name'  => $name
269
            ];
270
            $this->connection->watches->insert($data);
271
272
            return true;
273
        } catch (\Exception $e) {
274
            // if something goes wrong just ignore for now
275
            // @todo add exception
276
        }
277
        return false;
278
    }
279
@@ 285-305 (lines=21) @@
282
     * @param $name
283
     * @return bool
284
     */
285
    public function updateWatchedFunction($id, $name)
286
    {
287
        $name = trim($name);
288
        if (empty($name)) {
289
            return false;
290
        }
291
292
        try {
293
            $id = new \MongoId($id);
294
            $data = [
295
                '_id'   => $id,
296
                'name'  => $name
297
            ];
298
            $this->connection->watches->save($data);
299
300
            return true;
301
        } catch (\Exception $e) {
302
        }
303
304
        return false;
305
    }
306
307
    /**
308
     * @param $id