MultiStepFormRequestHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 37
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A gotoStep() 0 3 1
A checkAccessAction() 0 6 2
1
<?php
2
3
namespace LeKoala\MultiStepForm;
4
5
use SilverStripe\Forms\FormRequestHandler;
6
7
class MultiStepFormRequestHandler extends FormRequestHandler
8
{
9
10
    /**
11
     * Form model being handled
12
     *
13
     * @var MultiStepForm
14
     */
15
    protected $form = null;
16
17
    /**
18
     * @config
19
     * @var array
20
     */
21
    private static $allowed_actions = [
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
22
        'handleField',
23
        'httpSubmission',
24
        'forTemplate',
25
        'gotoStep',
26
    ];
27
28
    public function checkAccessAction($action)
29
    {
30
        if ($action === 'gotoStep') {
31
            return true;
32
        }
33
        return parent::checkAccessAction($action);
34
    }
35
36
    /**
37
     * @param HTTPRequest $request
0 ignored issues
show
Bug introduced by
The type LeKoala\MultiStepForm\HTTPRequest was not found. Did you mean HTTPRequest? If so, make sure to prefix the type with \.
Loading history...
38
     * @return HTTPResponse
0 ignored issues
show
Bug introduced by
The type LeKoala\MultiStepForm\HTTPResponse was not found. Did you mean HTTPResponse? If so, make sure to prefix the type with \.
Loading history...
39
     * @throws HTTPResponse_Exception
40
     */
41
    public function gotoStep($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

41
    public function gotoStep(/** @scrutinizer ignore-unused */ $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        return $this->form->gotoStep();
44
    }
45
}
46