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

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