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([
97
                'gtype' => $gtype,
98
                'select' => 'full',
99
            ])->all(), 'id', function ($model) {
100
                return Yii::t('hipanel:server:hub', $model->label);
101
            });
102
103
            return $result;
104
        }, 86400 * 24); // 24 days
105
106
        return $result;
107
    }

src/controllers/ServerController.php 1 location

@@ 664-676 (lines=13) @@
661
        return $result;
662
    }
663
664
    protected function getFullFromRef($gtype)
665
    {
666
        $callingMethod = debug_backtrace()[1]['function'];
667
        $result = Yii::$app->get('cache')->getOrSet([$callingMethod], function () use ($gtype) {
668
            $result = ArrayHelper::map(Ref::find()->where([
669
                'gtype' => $gtype,
670
                'select' => 'full',
671
            ])->all(), 'id', function ($model) {
672
                return Yii::t('hipanel:server:hub', $model->label);
673
            });
674
675
            return $result;
676
        }, 86400 * 24); // 24 days
677
678
        return $result;
679
    }