GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 19-19 lines in 2 locations

application/traits/SortModels.php 1 location

@@ 20-38 (lines=19) @@
17
     * @return bool
18
     * @throws yii\db\Exception
19
     */
20
    public static function sortModels($ids, $field = 'sort_order')
21
    {
22
        $priorities = [];
23
        $start=0;
24
        $ids_sorted = $ids;
25
        sort($ids_sorted);
26
        foreach ($ids as $id) {
27
            $priorities[$id] = $ids_sorted[$start++];
28
        }
29
        $sql = "UPDATE "
30
            . static::tableName()
31
            . " SET $field = "
32
            . static::generateCase($priorities)
33
            . " WHERE id IN(" . implode(', ', $ids)
34
            . ")";
35
        return Yii::$app->db->createCommand(
36
            $sql
37
        )->execute() > 0;
38
    }
39
40
    public static function generateCase($priorities)
41
    {

application/modules/shop/controllers/BackendProductController.php 1 location

@@ 644-662 (lines=19) @@
641
     * @return bool
642
     * @throws \yii\db\Exception
643
     */
644
    public static function sortModels($tableName, $ids, $field = 'sort_order')
645
    {
646
        $priorities = [];
647
        $start = 0;
648
        $ids_sorted = $ids;
649
        sort($ids_sorted);
650
        foreach ($ids as $id) {
651
            $priorities[$id] = $ids_sorted[$start++];
652
        }
653
        $sql = "UPDATE " . $tableName . " SET $field = " . self::generateCase($priorities) . " WHERE id IN(" . implode(
654
                ', ',
655
                $ids
656
            ) . ")";
657
658
        return Yii::$app->db->createCommand(
659
            $sql
660
        )->execute() > 0;
661
662
    }
663
664
    /**
665
     * Рекурсивный генератор свойств для создания комплектаций.