Code Duplication    Length = 12-14 lines in 4 locations

src/controllers/TariffController.php 4 locations

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