Completed
Pull Request — master (#647)
by Robbie
02:09
created

UserFormsStepField::FieldHolder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SilverStripe\UserForms\FormField;
4
5
/**
6
 * Represents a page step in a form, which may contain form fields or other groups
7
 */
8
class UserFormsStepField extends UserFormsCompositeField
9
{
10
    private static $casting = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $casting is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
11
        'StepNumber' => 'Int'
12
    ];
13
14
    /**
15
     * Numeric index (1 based) of this step
16
     *
17
     * Null if unassigned
18
     *
19
     * @var int|null
20
     */
21
    protected $number = null;
22
23
    public function FieldHolder($properties = [])
24
    {
25
        return $this->Field($properties);
26
    }
27
28
    /**
29
     * Get the step number
30
     *
31
     * @return int|null
32
     */
33
    public function getStepNumber()
34
    {
35
        return $this->number;
36
    }
37
38
    /**
39
     * Re-assign this step to another number
40
     *
41
     * @param type $number
42
     * @return $this
43
     */
44
    public function setStepNumber($number)
45
    {
46
        $this->number = $number;
0 ignored issues
show
Documentation Bug introduced by
It seems like $number of type object<SilverStripe\UserForms\FormField\type> is incompatible with the declared type integer|null of property $number.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
47
        return $this;
48
    }
49
}
50