Code Duplication    Length = 12-14 lines in 4 locations

src/controllers/TariffController.php 4 locations

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