Code Duplication    Length = 13-13 lines in 2 locations

src/controllers/HubController.php 1 location

@@ 92-104 (lines=13) @@
89
        return $this->getFullFromRef('type,nic_media');
90
    }
91
92
    protected function getFullFromRef($gtype)
93
    {
94
        $callingMethod = debug_backtrace()[1]['function'];
95
        $result = Yii::$app->get('cache')->getOrSet([$callingMethod], function () use ($gtype) {
96
            $result = ArrayHelper::map(Ref::find()->where(['gtype' => $gtype, 'select' => 'full'])->all(), 'id', function ($model) {
97
                return Yii::t('hipanel:server:hub', $model->label);
98
            });
99
100
            return $result;
101
        }, 86400 * 24); // 24 days
102
103
        return $result;
104
    }
105
}

src/controllers/ServerController.php 1 location

@@ 652-664 (lines=13) @@
649
        return $result;
650
    }
651
652
    protected function getFullFromRef($gtype)
653
    {
654
        $callingMethod = debug_backtrace()[1]['function'];
655
        $result = Yii::$app->get('cache')->getOrSet([$callingMethod], function () use ($gtype) {
656
            $result = ArrayHelper::map(Ref::find()->where(['gtype' => $gtype, 'select' => 'full'])->all(), 'id', function ($model) {
657
                return Yii::t('hipanel:server:hub', $model->label);
658
            });
659
660
            return $result;
661
        }, 86400 * 24); // 24 days
662
663
        return $result;
664
    }
665
666
    public function actionResources($id)
667
    {