Passed
Push — master ( 4c5faf...429320 )
by Chris
04:23
created

Textarea::getRows()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace WebTheory\Saveyour\Fields;
4
5
use WebTheory\Html\AbstractHtmlElement;
6
use WebTheory\Saveyour\Contracts\FormFieldInterface;
7
8
class Textarea extends AbstractStandardFormControl implements FormFieldInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    public $rows;
14
15
    /**
16
     * Get the value of rows
17
     *
18
     * @return int
19
     */
20
    public function getRows(): int
21
    {
22
        return $this->rows;
23
    }
24
25
    /**
26
     * Set the value of rows
27
     *
28
     * @param int $rows
29
     *
30
     * @return self
31
     */
32
    public function setRows(int $rows)
33
    {
34
        $this->rows = $rows;
35
36
        return $this;
37
    }
38
39
    /**
40
     *
41
     */
42
    protected function resolveAttributes(): AbstractHtmlElement
43
    {
44
        return parent::resolveAttributes()
45
            ->addAttribute('rows', $this->rows);
0 ignored issues
show
Bug introduced by
'rows' of type string is incompatible with the type array expected by parameter $attribute of WebTheory\Html\AbstractHtmlElement::addAttribute(). ( Ignorable by Annotation )

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

45
            ->addAttribute(/** @scrutinizer ignore-type */ 'rows', $this->rows);
Loading history...
46
    }
47
48
    /**
49
     *
50
     */
51
    protected function renderHtmlMarkup(): string
52
    {
53
        return $this->tag('textarea', $this->attributes, $this->value);
54
    }
55
}
56