Code Duplication    Length = 12-12 lines in 2 locations

collections/History.php 1 location

@@ 53-64 (lines=12) @@
50
    /**
51
     * @inheritdoc
52
     */
53
    public function getHistory($chatId, $limit = 10)
54
    {
55
        $query = new Query();
56
        $query->select(['user_id', 'username', 'message', 'timestamp', 'avatar_16', 'avatar_32'])
57
            ->from(self::collectionName())
58
            ->where(['chat_id' => $chatId]);
59
        $query->orderBy(['timestamp' => SORT_DESC]);
60
        if ($limit) {
61
            $query->limit($limit);
62
        }
63
        return $query->all();
64
    }
65
66
    /**
67
     * @inheritdoc

components/DbStorage.php 1 location

@@ 45-56 (lines=12) @@
42
    /**
43
     * @inheritdoc
44
     */
45
    public function getHistory($chatId, $limit = 10)
46
    {
47
        $query = new Query();
48
        $query->select(['user_id', 'username', 'message', 'timestamp', 'avatar_16', 'avatar_32'])
49
            ->from(self::tableName())
50
            ->where(['chat_id' => $chatId]);
51
        $query->orderBy(['timestamp' => SORT_DESC]);
52
        if ($limit) {
53
            $query->limit($limit);
54
        }
55
        return $query->all();
56
    }
57
58
    /**
59
     * @inheritdoc