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

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