Completed
Push — master ( 72a246...6ab249 )
by Helmut
05:19
created

ParagraphText   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 45
c 0
b 0
f 0
wmc 10
lcom 1
cbo 3
rs 10
ccs 17
cts 17
cp 1

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 4 1
A getButtonName() 0 4 1
A renderWith() 0 4 1
A setValueFromDefault() 0 4 1
A setValueFromModel() 0 4 2
A setValueFromRequest() 0 4 1
A fillModelWithValue() 0 4 2
A validateRequired() 0 4 1
1
<?php 
2
3
namespace Helmut\Forms\Fields\ParagraphText;
4
5
use Helmut\Forms\Field;
6
use Helmut\Forms\Utility\Validate;
7
8
class ParagraphText extends Field {
9
10
    protected $value = '';
11 6
12
    public function getValue()
13 6
    {
14
        return $this->value;
15
    }
16 8
17
    public function getButtonName()
18 8
    {
19
        //
20
    }   
21 4
22
    public function renderWith()
23 4
    {
24
        return ['value' => $this->value];
25
    }
26 8
27
    public function setValueFromDefault()
28 8
    {
29 8
        $this->value = $this->default;
30
    }
31 1
32
    public function setValueFromModel($model)
33 1
    {
34 1
        if (property_exists($model, $this->name)) $this->value = $model->{$this->name};
35
    }
36
37
    public function setValueFromRequest($request)
38
    {
39
        $this->value = $request->get($this->name);
40
    }
41 1
42
    public function fillModelWithValue($model)
43 1
    {
44 1
        if (property_exists($model, $this->name)) $model->{$this->name} = $this->value;
45
    }   
46 1
47
    public function validateRequired()
48 1
    {
49
        return Validate::required($this->value);
50
    }
51
52
}