Code Duplication    Length = 21-21 lines in 2 locations

src/Controllers/HandleController.php 2 locations

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