Code Duplication    Length = 21-21 lines in 2 locations

src/Controllers/HandleController.php 2 locations

@@ 41-61 (lines=21) @@
38
     *
39
     * @throws Exception
40
     */
41
    protected function resolveForm(Request $request)
42
    {
43
        if (!$request->has('_form_')) {
44
            throw new Exception('Invalid form request.');
45
        }
46
47
        $formClass = $request->get('_form_');
48
49
        if (!class_exists($formClass)) {
50
            throw new Exception("Form [{$formClass}] does not exist.");
51
        }
52
53
        /** @var Form $form */
54
        $form = app($formClass);
55
56
        if (!method_exists($form, 'handle')) {
57
            throw new Exception("Form method {$formClass}::handle() does not exist.");
58
        }
59
60
        return $form;
61
    }
62
63
    /**
64
     * @param Request $request
@@ 108-128 (lines=21) @@
105
     *
106
     * @throws Exception
107
     */
108
    protected function resolveActionInstance(Request $request)
109
    {
110
        if (!$request->has('_action')) {
111
            throw new Exception('Invalid action request.');
112
        }
113
114
        $actionClass = str_replace('_', '\\', $request->get('_action'));
115
116
        if (!class_exists($actionClass)) {
117
            throw new Exception("Form [{$actionClass}] does not exist.");
118
        }
119
120
        /** @var GridAction $form */
121
        $action = app($actionClass);
122
123
        if (!method_exists($action, 'handle')) {
124
            throw new Exception("Action method {$actionClass}::handle() does not exist.");
125
        }
126
127
        return $action;
128
    }
129
130
    /**
131
     * @param Request $request