Code Duplication    Length = 12-14 lines in 6 locations

src/controllers/TariffController.php 6 locations

@@ 70-83 (lines=14) @@
67
        ]);
68
    }
69
70
    public function actionCreateDomain($parent_id = null)
71
    {
72
        /** @var DomainTariffManager $manager */
73
        $manager = TariffManagerFactory::createByType('domain', $parent_id);
74
        $form = $manager->form;
75
76
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
77
            $manager->insert();
78
79
            return $this->redirect(['view', 'id' => $form->id]);
80
        }
81
82
        return $this->render('domain/create', ['model' => $form]);
83
    }
84
85
    public function actionCreateSvds($parent_id = null)
86
    {
@@ 85-97 (lines=13) @@
82
        return $this->render('domain/create', ['model' => $form]);
83
    }
84
85
    public function actionCreateSvds($parent_id = null)
86
    {
87
        /** @var DomainTariffManager $manager */
88
        $manager = TariffManagerFactory::createByType('svds', $parent_id);
89
90
        $form = $manager->form;
91
92
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
93
            $manager->insert();
94
95
            return $this->redirect(['view', 'id' => $form->id]);
96
        }
97
98
        return $this->render('vds/create', ['model' => $form]);
99
    }
100
@@ 101-113 (lines=13) @@
98
        return $this->render('vds/create', ['model' => $form]);
99
    }
100
101
    public function actionCreateOvds($parent_id = null)
102
    {
103
        /** @var DomainTariffManager $manager */
104
        $manager = TariffManagerFactory::createByType('ovds', $parent_id);
105
        $form = $manager->form;
106
107
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
108
            $manager->insert();
109
110
            return $this->redirect(['view', 'id' => $form->id]);
111
        }
112
113
        return $this->render('vds/create', ['model' => $form]);
114
    }
115
116
    public function actionCreateCertificate($parent_id = null)
@@ 116-128 (lines=13) @@
113
        return $this->render('vds/create', ['model' => $form]);
114
    }
115
116
    public function actionCreateCertificate($parent_id = null)
117
    {
118
        /** @var CertificateResource $manager */
119
        $manager = TariffManagerFactory::createByType('certificate', $parent_id);
120
        $form = $manager->form;
121
122
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
123
            $manager->insert();
124
125
            return $this->redirect(['view', 'id' => $form->id]);
126
        }
127
128
        return $this->render('certificate/create', ['model' => $form]);
129
    }
130
131
    public function actionCreateServer($parent_id = null)
@@ 131-143 (lines=13) @@
128
        return $this->render('certificate/create', ['model' => $form]);
129
    }
130
131
    public function actionCreateServer($parent_id = null)
132
    {
133
        /** @var CertificateResource $manager */
134
        $manager = TariffManagerFactory::createByType('server', $parent_id);
135
        $form = $manager->form;
136
137
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
138
            $manager->insert();
139
140
            return $this->redirect(['view', 'id' => $form->id]);
141
        }
142
143
        return $this->render('server/create', ['model' => $form]);
144
    }
145
146
    public function actionUpdate($id)
@@ 146-157 (lines=12) @@
143
        return $this->render('server/create', ['model' => $form]);
144
    }
145
146
    public function actionUpdate($id)
147
    {
148
        $manager = TariffManagerFactory::createById($id, ['scenario' => 'update']);
149
        $form = $manager->form;
150
151
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
152
            $manager->update();
153
154
            return $this->redirect(['view', 'id' => $form->id]);
155
        }
156
157
        return $this->render($manager->getType() . '/update', ['model' => $form]);
158
    }
159
160
    public function actionCopy()