Code Duplication    Length = 12-14 lines in 4 locations

src/controllers/TariffController.php 4 locations

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