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

Textarea   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 46
ccs 0
cts 17
cp 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A renderHtmlMarkup() 0 3 1
A resolveAttributes() 0 4 1
A setRows() 0 5 1
A getRows() 0 3 1
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