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

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