Code Duplication    Length = 4-4 lines in 2 locations

system/modules/Ecommerce/Ecommerce.php 1 location

@@ 495-498 (lines=4) @@
492
    public function getFavoriteCount() {
493
        if (Users\User::$cur->id) {
494
            return \Ecommerce\Favorite::getCount(['user_id', Users\User::$cur->id]);
495
        } else {
496
            $favs = !empty($_COOKIE['ecommerce_favitems']) ? json_decode($_COOKIE['ecommerce_favitems'], true) : [];
497
            return count($favs);
498
        }
499
    }
500
501
    public function siteSearch($search) {

system/modules/Ecommerce/models/Item.php 1 location

@@ 490-493 (lines=4) @@
487
        if (\Users\User::$cur->id) {
488
            $fav = \Ecommerce\Favorite::get([['user_id', \Users\User::$cur->id], ['item_id', $this->id]]);
489
            return (bool) $fav;
490
        } else {
491
            $favs = !empty($_COOKIE['ecommerce_favitems']) ? json_decode($_COOKIE['ecommerce_favitems'], true) : [];
492
            return in_array($this->id, $favs);
493
        }
494
    }
495
}