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

@@ 614-632 (lines=19) @@
611
     * @return bool
612
     * @throws \yii\db\Exception
613
     */
614
    public static function sortModels($tableName, $ids, $field = 'sort_order')
615
    {
616
        $priorities = [];
617
        $start = 0;
618
        $ids_sorted = $ids;
619
        sort($ids_sorted);
620
        foreach ($ids as $id) {
621
            $priorities[$id] = $ids_sorted[$start++];
622
        }
623
        $sql = "UPDATE " . $tableName . " SET $field = " . self::generateCase($priorities) . " WHERE id IN(" . implode(
624
                ', ',
625
                $ids
626
            ) . ")";
627
628
        return Yii::$app->db->createCommand(
629
            $sql
630
        )->execute() > 0;
631
632
    }
633
634
    /**
635
     * Рекурсивный генератор свойств для создания комплектаций.