Code Duplication    Length = 36-36 lines in 2 locations

src/controllers/AnswerController.php 1 location

@@ 18-53 (lines=36) @@
15
use hipanel\actions\SmartPerformAction;
16
use Yii;
17
18
class AnswerController extends \hipanel\base\CrudController
19
{
20
    public function actions()
21
    {
22
        return [
23
            'update'   => [
24
                'class'      => SmartPerformAction::class,
25
                'scenario'   => 'update',
26
                'success'    => Yii::t('hipanel/ticket', 'Comment was updated'),
27
                'POST'  => [
28
                    'save'    => true,
29
                    'success' => [
30
                        'class'       => RedirectAction::class,
31
                        'url'        => function () {
32
                            $answer = Yii::$app->request->post('Answer');
33
34
                            return ['@ticket/view', 'id' => $answer['id']];
35
                        },
36
                    ],
37
                ],
38
            ],
39
        ];
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    protected function prepareRefs()
46
    {
47
        return [
48
            'topic_data'    => $this->getRefs('topic,ticket', 'hipanel/ticket'),
49
            'state_data'    => $this->getClassRefs('state', 'hipanel/ticket'),
50
            'priority_data' => $this->getPriorities(),
51
        ];
52
    }
53
}
54

src/controllers/ReminderController.php 1 location

@@ 9-44 (lines=36) @@
6
use hipanel\actions\SmartPerformAction;
7
use Yii;
8
9
class ReminderController extends \hipanel\base\CrudController
10
{
11
    public function actions()
12
    {
13
        return [
14
            'create' => [
15
                'class' => SmartPerformAction::class,
16
                'scenario' => 'update',
17
                'success' => Yii::t('hipanel/ticket', 'Comment was updated'),
18
                'POST' => [
19
                    'save' => true,
20
                    'success' => [
21
                        'class' => RedirectAction::class,
22
                        'url' => function () {
23
                            $answer = Yii::$app->request->post('Answer');
24
25
                            return ['@ticket/view', 'id' => $answer['id']];
26
                        },
27
                    ],
28
                ],
29
            ],
30
        ];
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    protected function prepareRefs()
37
    {
38
        return [
39
            'topic_data' => $this->getRefs('topic,ticket', 'hipanel/ticket'),
40
            'state_data' => $this->getClassRefs('state', 'hipanel/ticket'),
41
            'priority_data' => $this->getPriorities(),
42
        ];
43
    }
44
}
45