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

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