Completed
Push — master ( 89fe2f...2bde54 )
by wen
05:41
created

Textarea::getAutoSize()   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
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class Textarea extends NamedElement
6
{
7
    protected $type = 'textarea';
8
9
    protected $rows = 2;
10
11
    protected $autoSize = true;
12
13
    public function getRows()
14
    {
15
        return $this->rows;
16
    }
17
18
    public function setRows($value)
19
    {
20
        $this->rows = $value;
21
22
        return $this;
23
    }
24
25
    /**
26
     * @return bool|array
27
     */
28
    public function getAutoSize()
29
    {
30
        return $this->autoSize;
31
    }
32
33
    /**
34
     * @param int $max
35
     * @param int $min
36
     *
37
     * @return $this
38
     */
39
    public function setAutoSize($max, $min = 1)
40
    {
41
        $this->autoSize = [
0 ignored issues
show
Documentation Bug introduced by
It seems like array('minRows' => intva...xRows' => intval($max)) of type array<string,integer,{"m...","maxRows":"integer"}> is incompatible with the declared type boolean of property $autoSize.

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...
42
            'minRows' => intval($min),
43
            'maxRows' => intval($max),
44
        ];
45
46
        return $this;
47
    }
48
49
    public function toArray()
50
    {
51
        return parent::toArray() + [
52
                'rows'     => $this->getRows(),
53
                'autosize' => $this->getAutoSize(),
54
            ];
55
    }
56
}
57