Code Duplication    Length = 12-14 lines in 6 locations

src/controllers/TariffController.php 6 locations

@@ 125-136 (lines=12) @@
122
        return $this->render('server/create', ['model' => $form]);
123
    }
124
125
    public function actionUpdate($id)
126
    {
127
        $manager = TariffManagerFactory::createById($id, ['scenario' => 'update']);
128
        $form = $manager->form;
129
130
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
131
            $manager->update();
132
            return $this->redirect(['view', 'id' => $form->id]);
133
        }
134
135
        return $this->render($manager->getType() . '/update', ['model' => $form]);
136
    }
137
138
    public function actionCopy()
139
    {
@@ 54-67 (lines=14) @@
51
        ];
52
    }
53
54
    public function actionCreateDomain($parent_id = null)
55
    {
56
        /** @var DomainTariffManager $manager */
57
        $manager = TariffManagerFactory::createByType('domain', $parent_id);
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
    {
70
        /** @var DomainTariffManager $manager */
@@ 68-80 (lines=13) @@
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)
@@ 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 actionCreateCertificate($parent_id = null)
98
    {
@@ 97-109 (lines=13) @@
94
        return $this->render('vds/create', ['model' => $form]);
95
    }
96
97
    public function actionCreateCertificate($parent_id = null)
98
    {
99
        /** @var CertificateResource $manager */
100
        $manager = TariffManagerFactory::createByType('certificate', $parent_id);
101
        $form = $manager->form;
102
103
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
104
            $manager->insert();
105
            return $this->redirect(['view', 'id' => $form->id]);
106
        }
107
108
        return $this->render('certificate/create', ['model' => $form]);
109
    }
110
111
    public function actionCreateServer($parent_id = null)
112
    {
@@ 111-123 (lines=13) @@
108
        return $this->render('certificate/create', ['model' => $form]);
109
    }
110
111
    public function actionCreateServer($parent_id = null)
112
    {
113
        /** @var CertificateResource $manager */
114
        $manager = TariffManagerFactory::createByType('server', $parent_id);
115
        $form = $manager->form;
116
117
        if (Yii::$app->request->isPost && $form->load(Yii::$app->request->post())) {
118
            $manager->insert();
119
            return $this->redirect(['view', 'id' => $form->id]);
120
        }
121
122
        return $this->render('server/create', ['model' => $form]);
123
    }
124
125
    public function actionUpdate($id)
126
    {