Textarea   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inputAttributes() 0 7 1
A renderInner() 0 9 1
1
<?php
2
namespace Rocket\UI\Forms\Fields;
3
4
/**
5
 * Manage textarea
6
 */
7
8
/**
9
 * Creates a Textarea with Form_element
10
 *
11
 * @author Stéphane Goetz
12
 */
13
class Textarea extends Field
14
{
15
    /**
16
     * Change the textarea attributes to be compatible
17
     */
18
    protected function inputAttributes()
19
    {
20
        $this->input_attributes['id'] = $this->id;
21
        $this->input_attributes['name'] = $this->name;
22
        $this->input_attributes['cols'] = 90;
23
        $this->input_attributes['rows'] = $this->params['height'];
24
    }
25
26
    /**
27
     * Render the file as a textarea and not input
28
     */
29
    protected function renderInner()
30
    {
31
        $val = $this->input_attributes['value'];
32
        unset($this->input_attributes['value']);
33
34
        $attributes = $this->renderAttributes($this->input_attributes);
35
36
        $this->result .= "<textarea $attributes>" . htmlentities($val, ENT_QUOTES, 'UTF-8', false) . '</textarea>';
37
    }
38
}
39