Textarea   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 42
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRows() 0 3 1
A setRows() 0 5 1
A resolveAttributes() 0 6 1
A renderHtmlMarkup() 0 3 1
1
<?php
2
3
namespace WebTheory\Saveyour\Field\Type;
4
5
use WebTheory\Saveyour\Contracts\Field\FormFieldInterface;
6
use WebTheory\Saveyour\Field\Type\Abstracts\AbstractStandardFormControl;
7
8
class Textarea extends AbstractStandardFormControl implements FormFieldInterface
9
{
10
    public ?int $rows = null;
11
12
    /**
13
     * Get the value of rows
14
     *
15
     * @return int
16
     */
17
    public function getRows(): int
18
    {
19
        return $this->rows;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->rows could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
20
    }
21
22
    /**
23
     * Set the value of rows
24
     *
25
     * @param int $rows
26
     *
27
     * @return $this
28
     */
29
    public function setRows(int $rows): Textarea
30
    {
31
        $this->rows = $rows;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return $this
38
     */
39
    protected function resolveAttributes(): Textarea
40
    {
41
        parent::resolveAttributes()
42
            ->addAttribute('rows', $this->rows);
43
44
        return $this;
45
    }
46
47
    protected function renderHtmlMarkup(): string
48
    {
49
        return $this->tag('textarea', $this->attributes, $this->value);
50
    }
51
}
52