Code Duplication    Length = 12-13 lines in 3 locations

src/controllers/TariffController.php 3 locations

@@ 56-68 (lines=13) @@
53
        ];
54
    }
55
56
    public function actionCreateDomain()
57
    {
58
        /** @var DomainTariffManager $manager */
59
        $manager = TariffManagerFactory::createByType('domain', ['scenario' => 'create']);
60
        $form = $manager->form;
61
62
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
63
            $manager->insert();
64
            return $this->redirect(['view', 'id' => $form->id]);
65
        }
66
67
        return $this->render('domain/create', ['model' => $form]);
68
    }
69
70
    public function actionCreateSvds()
71
    {
@@ 70-82 (lines=13) @@
67
        return $this->render('domain/create', ['model' => $form]);
68
    }
69
70
    public function actionCreateSvds()
71
    {
72
        /** @var DomainTariffManager $manager */
73
        $manager = TariffManagerFactory::createByType('svds', ['scenario' => 'create']);
74
        $form = $manager->form;
75
76
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
77
            $manager->insert();
78
            return $this->redirect(['view', 'id' => $form->id]);
79
        }
80
81
        return $this->render('vds/create', ['model' => $form]);
82
    }
83
84
    public function actionUpdate($id)
85
    {
@@ 84-95 (lines=12) @@
81
        return $this->render('vds/create', ['model' => $form]);
82
    }
83
84
    public function actionUpdate($id)
85
    {
86
        $manager = TariffManagerFactory::createById($id, ['scenario' => 'update']);
87
        $form = $manager->form;
88
89
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
90
            $manager->update();
91
            return $this->redirect(['view', 'id' => $form->id]);
92
        }
93
94
        return $this->render($manager->getType() . '/update', ['model' => $form]);
95
    }
96
97
    public function actionView($id)
98
    {