Code Duplication    Length = 21-22 lines in 2 locations

src/Notifynder/Notifications/NotificationRepository.php 2 locations

@@ 227-248 (lines=22) @@
224
     * @param Closure|null $filterScope
225
     * @return mixed
226
     */
227
    public function getNotRead(
228
        $to_id,
229
        $entity,
230
        $limit = null,
231
        $paginate = null,
232
        $orderDate = 'desc',
233
        Closure $filterScope = null
234
    ) {
235
        $query = $this->notification->with('body', 'from')
236
            ->wherePolymorphic($to_id, $entity)
237
            ->withNotRead()
238
            ->orderBy('read', 'ASC')
239
            ->orderBy('created_at', $orderDate);
240
241
        $query = $this->applyFilter($filterScope, $query);
242
243
        if (is_int(intval($paginate)) && $paginate) {
244
            return $query->paginate($limit);
245
        }
246
247
        return $query->get();
248
    }
249
250
    /**
251
     * Retrive all notifications, not read
@@ 264-284 (lines=21) @@
261
     * @param Closure   $filterScope
262
     * @return mixed
263
     */
264
    public function getAll(
265
        $to_id,
266
        $entity,
267
        $limit = null,
268
        $paginate = null,
269
        $orderDate = 'desc',
270
        Closure $filterScope = null
271
    ) {
272
        $query = $this->notification->with('body', 'from')
273
            ->wherePolymorphic($to_id, $entity)
274
            ->orderBy('read', 'ASC')
275
            ->orderBy('created_at', $orderDate);
276
277
        $query = $this->applyFilter($filterScope, $query);
278
279
        if (is_int(intval($paginate)) && $paginate) {
280
            return $query->paginate($limit);
281
        }
282
283
        return $query->get();
284
    }
285
286
    /**
287
     * get number Notifications